From 7180aad07623a764bece095e355de30a5f73d848 Mon Sep 17 00:00:00 2001 From: La Reclame Date: Tue, 3 Dec 2013 09:34:02 +0100 Subject: [PATCH 1/6] Changed td to th in one of the example for testing --- demo/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/demo/index.html b/demo/index.html index 9b8796a..15574bf 100644 --- a/demo/index.html +++ b/demo/index.html @@ -90,10 +90,10 @@

Some examples

- - - - + + + + From 817f48f819248afeb65171de7fefe4c4b3a60d4f Mon Sep 17 00:00:00 2001 From: La Reclame Date: Tue, 3 Dec 2013 09:34:08 +0100 Subject: [PATCH 2/6] Change of version --- demo/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/index.html b/demo/index.html index 15574bf..3233608 100644 --- a/demo/index.html +++ b/demo/index.html @@ -22,7 +22,7 @@
-

jQuery ReStable v0.1.0

+

jQuery ReStable v0.1.1

jQuery ReStable is a very simple and lightweight (~1Kb) jQuery plugin that make tables responsive making them collapse into ul lists.

From d10a6ec4a5874255b2169d559e2eda7900f1aaa3 Mon Sep 17 00:00:00 2001 From: La Reclame Date: Tue, 3 Dec 2013 09:34:16 +0100 Subject: [PATCH 3/6] Added th styling --- demo/main.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/main.css b/demo/main.css index 88ff043..a966d2a 100644 --- a/demo/main.css +++ b/demo/main.css @@ -13,7 +13,7 @@ pre {background-color: #fafafa;padding: 20px;overflow: auto;border: 1px solid #f .download_button:hover {background-color: #eaeaea;} table {width: 100%;text-align: center;border: 0;border-collapse: collapse;border-spacing: 0;font-size: 14px;} -table td {padding: 10px;margin: 0;} +table td, table th {padding: 10px;margin: 0;} table thead {background-color: #bbb;color: #fff;font-weight: 800;} table tbody tr td{border-bottom: 1px solid #eee;} table tbody tr:hover td{background-color: #eee;} \ No newline at end of file From 0c6311758339eefe552d249cee9cc1dc25b57ec7 Mon Sep 17 00:00:00 2001 From: La Reclame Date: Tue, 3 Dec 2013 09:35:59 +0100 Subject: [PATCH 4/6] Fix #2 - no 'use strict' - mixed spaces and tabs - missing radix parameter and some other jslint errors --- jquery.restable.js | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/jquery.restable.js b/jquery.restable.js index e4dacfc..083e154 100644 --- a/jquery.restable.js +++ b/jquery.restable.js @@ -1,6 +1,8 @@ -/*! ReStable v0.1 by Alessandro Benoit */ +/*! ReStable v0.1.1 by Alessandro Benoit */ (function ($, window, i) { + 'use strict'; + $.fn.ReStable = function (options) { // Settings @@ -14,7 +16,7 @@ var $cols = [], $result = {}, - $cols_header = $(element).find('tr').first().children('td'), + $cols_header = $(element).find('tr').first().children('td,th'), $row_number = 0, $list; @@ -31,25 +33,23 @@ $(element).find('tr').slice(1).each(function () { var $row = $(this); - $row_number++; + $row_number += 1; $.each($cols, function (index, value) { - index++; + index += 1; if (s.rowHeaders) { - if (!$result[value]) { $result[value] = {}; } + if (!$result[value]) { $result[value] = {}; } $result[value][$row.children('td:nth-child(1)').text()] = $row.children('td:nth-child(' + (index + 1) + ')').text(); } else { - if (!$result[$row_number]) { $result[$row_number] = {}; } + if (!$result[$row_number]) { $result[$row_number] = {}; } $result[$row_number][value] = $row.children('td:nth-child(' + index + ')').text(); } }); }); - - console.log($result); // Crea la lista $list = $('
    ', { @@ -57,15 +57,14 @@ id: 'tabletolist' + i }).insertBefore($(element)); $.each($result, function (index, value) { - - var $myrow = $('
  • ', { - html: (s.rowHeaders)? '' + index + '' : '' - }).appendTo($list); - var $myrowul = $('
      ').appendTo($myrow); + var $myrow = $('
    • ', { + html: (s.rowHeaders) ? '' + index + '' : '' + }).appendTo($list), + $myrowul = $('
        ').appendTo($myrow); $.each(value, function (index, value) { - + $('
      • ', { html: '' + index + ' ' + value + '' }).appendTo($myrowul); @@ -84,12 +83,12 @@ var element = $(this), responsive_table; - i++; + i += 1; // The responsive menu is built if the page size is or goes under maxWidth function handle_table() { - if ($(window).width() > parseInt(s.maxWidth)) { + if ($(window).width() > parseInt(s.maxWidth, 10)) { $(element).show(); From 5365c773a2578614e42fe61fbf0d204510e366a5 Mon Sep 17 00:00:00 2001 From: La Reclame Date: Tue, 3 Dec 2013 09:36:14 +0100 Subject: [PATCH 5/6] Version 0.1.1 --- jquery.restable.min.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.restable.min.js b/jquery.restable.min.js index e55d622..ac3af6d 100644 --- a/jquery.restable.min.js +++ b/jquery.restable.min.js @@ -1,2 +1,2 @@ -/*! ReStable v0.1 by Alessandro Benoit */ -(function(e,t,n){e.fn.ReStable=function(r){function o(t,n){var r=[],i={},o=e(t).find("tr").first().children("td"),u=0,a;if(s.rowHeaders){o=o.slice(1)}o.each(function(){r.push(e(this).text())});e(t).find("tr").slice(1).each(function(){var t=e(this);u++;e.each(r,function(e,n){e++;if(s.rowHeaders){if(!i[n]){i[n]={}}i[n][t.children("td:nth-child(1)").text()]=t.children("td:nth-child("+(e+1)+")").text()}else{if(!i[u]){i[u]={}}i[u][n]=t.children("td:nth-child("+e+")").text()}})});console.log(i);a=e("
          ",{"class":"tabletolist "+(s.rowHeaders?"rh":"nrh"),id:"tabletolist"+n}).insertBefore(e(t));e.each(i,function(t,n){var r=e("
        • ",{html:s.rowHeaders?''+t+"":""}).appendTo(a);var i=e("
            ").appendTo(r);e.each(n,function(t,n){e("
          • ",{html:''+t+' '+n+""}).appendTo(i)})});return a}var s=e.extend({rowHeaders:true,maxWidth:480},r);this.each(function(){function a(){if(e(t).width()>parseInt(s.maxWidth)){e(r).show();if(u){e(u).hide()}}else{e(r).hide();if(u){e(u).show()}else{u=o(r,n)}}}var r=e(this),u;n++;a();e(t).resize(function(){a()})})};e.ReStable=function(t){e("table").ReStable(t)}})(jQuery,this,0) \ No newline at end of file +/*! ReStable v0.1.1 by Alessandro Benoit */ +(function(e,t,n){"use strict";e.fn.ReStable=function(r){function o(t,n){var r=[],i={},o=e(t).find("tr").first().children("td,th"),u=0,a;if(s.rowHeaders){o=o.slice(1)}o.each(function(){r.push(e(this).text())});e(t).find("tr").slice(1).each(function(){var t=e(this);u+=1;e.each(r,function(e,n){e+=1;if(s.rowHeaders){if(!i[n]){i[n]={}}i[n][t.children("td:nth-child(1)").text()]=t.children("td:nth-child("+(e+1)+")").text()}else{if(!i[u]){i[u]={}}i[u][n]=t.children("td:nth-child("+e+")").text()}})});a=e("
              ",{"class":"tabletolist "+(s.rowHeaders?"rh":"nrh"),id:"tabletolist"+n}).insertBefore(e(t));e.each(i,function(t,n){var r=e("
            • ",{html:s.rowHeaders?''+t+"":""}).appendTo(a),i=e("
                ").appendTo(r);e.each(n,function(t,n){e("
              • ",{html:''+t+' '+n+""}).appendTo(i)})});return a}var s=e.extend({rowHeaders:true,maxWidth:480},r);this.each(function(){function a(){if(e(t).width()>parseInt(s.maxWidth,10)){e(r).show();if(u){e(u).hide()}}else{e(r).hide();if(u){e(u).show()}else{u=o(r,n)}}}var r=e(this),u;n+=1;a();e(t).resize(function(){a()})})};e.ReStable=function(t){e("table").ReStable(t)}})(jQuery,this,0) \ No newline at end of file From c9f04795c5741b5d13bb4cf5e3294ab6e4e43e28 Mon Sep 17 00:00:00 2001 From: La Reclame Date: Tue, 3 Dec 2013 09:36:39 +0100 Subject: [PATCH 6/6] Fix #1 - Added bower package --- bower.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 bower.json diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..960b533 --- /dev/null +++ b/bower.json @@ -0,0 +1,20 @@ +{ + "name": "ReStable", + "version": "0.1.1", + "description": "jQuery plugin that make tables responsive", + "keywords": [ + "table", + "responsive" + ], + "main": [ + "jquery.restable.min.js", + "jquery.restable.min.css" + ], + "ignore": [ + "demo" + ], + "dependencies": { + "jquery": ">=1.6.4" + }, + "license": "MIT" +} \ No newline at end of file
PeriodFull BoardHalf BoardBed and BreakfastPeriodFull BoardHalf BoardBed and Breakfast