fomantic-ui-sass 2.6.4 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +102 -0
- data/.travis.yml +9 -3
- data/README.md +4 -2
- data/Rakefile +25 -3
- data/app/assets/fonts/semantic-ui/brand-icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.svg +178 -11
- data/app/assets/fonts/semantic-ui/brand-icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/icons.svg +1138 -92
- data/app/assets/fonts/semantic-ui/icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.svg +127 -26
- data/app/assets/fonts/semantic-ui/outline-icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff2 +0 -0
- data/app/assets/javascripts/semantic-ui.js +1 -1
- data/app/assets/javascripts/semantic-ui/accordion.js +5 -1
- data/app/assets/javascripts/semantic-ui/api.js +9 -2
- data/app/assets/javascripts/semantic-ui/calendar.js +25 -12
- data/app/assets/javascripts/semantic-ui/checkbox.js +39 -2
- data/app/assets/javascripts/semantic-ui/dimmer.js +25 -5
- data/app/assets/javascripts/semantic-ui/dropdown.js +130 -47
- data/app/assets/javascripts/semantic-ui/embed.js +5 -1
- data/app/assets/javascripts/semantic-ui/form.js +24 -19
- data/app/assets/javascripts/semantic-ui/modal.js +33 -17
- data/app/assets/javascripts/semantic-ui/nag.js +5 -1
- data/app/assets/javascripts/semantic-ui/popup.js +10 -5
- data/app/assets/javascripts/semantic-ui/progress.js +5 -1
- data/app/assets/javascripts/semantic-ui/rating.js +21 -6
- data/app/assets/javascripts/semantic-ui/search.js +43 -27
- data/app/assets/javascripts/semantic-ui/shape.js +5 -1
- data/app/assets/javascripts/semantic-ui/sidebar.js +7 -3
- data/app/assets/javascripts/semantic-ui/site.js +6 -2
- data/app/assets/javascripts/semantic-ui/slider.js +1216 -0
- data/app/assets/javascripts/semantic-ui/state.js +5 -1
- data/app/assets/javascripts/semantic-ui/sticky.js +5 -1
- data/app/assets/javascripts/semantic-ui/tab.js +10 -3
- data/app/assets/javascripts/semantic-ui/toast.js +6 -2
- data/app/assets/javascripts/semantic-ui/transition.js +6 -2
- data/app/assets/javascripts/semantic-ui/visibility.js +6 -2
- data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +7 -7
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +59 -83
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +110 -124
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +262 -237
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +155 -118
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +332 -145
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +2281 -2415
- data/app/assets/stylesheets/semantic-ui/elements/_container.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +10 -10
- data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +81 -81
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +178 -191
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +71 -103
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +8 -8
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +61 -40
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +1087 -444
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +69 -69
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +510 -155
- data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +20 -14
- data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +26 -26
- data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +8 -8
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +180 -216
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +34 -39
- data/app/assets/stylesheets/semantic-ui/elements/_text.scss +114 -0
- data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +11 -20
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +16 -16
- data/app/assets/stylesheets/semantic-ui/modules/_all.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +23 -23
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +32 -32
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +128 -155
- data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +13 -13
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +50 -48
- data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +15 -15
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +50 -50
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +30 -44
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +137 -111
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +24 -28
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +6 -6
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +29 -29
- data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +768 -0
- data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +3 -3
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +10 -14
- data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +27 -16
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +6 -6
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +103 -133
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +26 -26
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +27 -27
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +54 -54
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +138 -108
- data/app/helpers/semantic_breadcrumbs_helper.rb +1 -1
- data/app/helpers/semantic_flash_helper.rb +4 -2
- data/app/helpers/semantic_icon_helper.rb +1 -1
- data/fomantic-ui-sass.gemspec +20 -19
- data/gemfiles/rails_5.0.gemfile +5 -0
- data/gemfiles/rails_5.1.gemfile +5 -0
- data/gemfiles/rails_5.2.gemfile +5 -0
- data/lib/fomantic-ui-sass.rb +3 -4
- data/lib/fomantic/ui/sass/breadcrumbs.rb +2 -4
- data/lib/fomantic/ui/sass/engine.rb +3 -3
- data/lib/fomantic/ui/sass/version.rb +2 -2
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/bin/bundle +1 -1
- data/spec/dummy/bin/rails +1 -1
- data/spec/dummy/bin/rake +0 -0
- data/spec/dummy/config.ru +1 -1
- data/spec/dummy/config/application.rb +5 -6
- data/spec/dummy/config/boot.rb +3 -3
- data/spec/dummy/config/environment.rb +1 -1
- data/spec/dummy/config/environments/test.rb +1 -1
- data/spec/helpers/semantic_breadcrumbs_helper_spec.rb +30 -32
- data/spec/helpers/semantic_flash_helper_spec.rb +15 -16
- data/spec/helpers/semantic_icon_helper_spec.rb +10 -10
- data/spec/spec_helper.rb +4 -6
- data/tasks/converter.rb +61 -73
- data/templates/project/manifest.rb +1 -2
- metadata +45 -23
- data/app/assets/javascripts/semantic-ui/range.js +0 -278
- data/app/assets/stylesheets/semantic-ui/modules/_range.scss +0 -192
@@ -12,6 +12,10 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
+
$.isFunction = $.isFunction || function(obj) {
|
16
|
+
return typeof obj === "function" && typeof obj.nodeType !== "number";
|
17
|
+
};
|
18
|
+
|
15
19
|
window = (typeof window != 'undefined' && window.Math == Math)
|
16
20
|
? window
|
17
21
|
: (typeof self != 'undefined' && self.Math == Math)
|
@@ -445,7 +449,7 @@ $.fn.search = function(parameters) {
|
|
445
449
|
if(settings.type === 'category') {
|
446
450
|
module.debug('Finding result that matches', value);
|
447
451
|
$.each(results, function(index, category) {
|
448
|
-
if(
|
452
|
+
if(Array.isArray(category.results)) {
|
449
453
|
result = module.search.object(value, category.results, lookupFields)[0];
|
450
454
|
// don't continue searching if a result is found
|
451
455
|
if(result) {
|
@@ -525,7 +529,7 @@ $.fn.search = function(parameters) {
|
|
525
529
|
}
|
526
530
|
else {
|
527
531
|
module.debug('Querying for', searchTerm);
|
528
|
-
if($.isPlainObject(settings.source) ||
|
532
|
+
if($.isPlainObject(settings.source) || Array.isArray(settings.source)) {
|
529
533
|
module.search.local(searchTerm);
|
530
534
|
callback();
|
531
535
|
}
|
@@ -611,7 +615,7 @@ $.fn.search = function(parameters) {
|
|
611
615
|
;
|
612
616
|
|
613
617
|
// search fields should be array to loop correctly
|
614
|
-
if(
|
618
|
+
if(!Array.isArray(searchFields)) {
|
615
619
|
searchFields = [searchFields];
|
616
620
|
}
|
617
621
|
|
@@ -687,6 +691,11 @@ $.fn.search = function(parameters) {
|
|
687
691
|
|
688
692
|
parse: {
|
689
693
|
response: function(response, searchTerm) {
|
694
|
+
if(Array.isArray(response)){
|
695
|
+
var o={};
|
696
|
+
o[fields.results]=response;
|
697
|
+
response = o;
|
698
|
+
}
|
690
699
|
var
|
691
700
|
searchHTML = module.generateResults(response)
|
692
701
|
;
|
@@ -996,7 +1005,7 @@ $.fn.search = function(parameters) {
|
|
996
1005
|
var
|
997
1006
|
template = settings.templates[settings.type],
|
998
1007
|
isProperObject = ($.isPlainObject(response[fields.results]) && !$.isEmptyObject(response[fields.results])),
|
999
|
-
isProperArray = (
|
1008
|
+
isProperArray = (Array.isArray(response[fields.results]) && response[fields.results].length > 0),
|
1000
1009
|
html = ''
|
1001
1010
|
;
|
1002
1011
|
if(isProperObject || isProperArray ) {
|
@@ -1011,7 +1020,7 @@ $.fn.search = function(parameters) {
|
|
1011
1020
|
}
|
1012
1021
|
}
|
1013
1022
|
if($.isFunction(template)) {
|
1014
|
-
html = template(response, fields);
|
1023
|
+
html = template(response, fields, settings.preserveHTML);
|
1015
1024
|
}
|
1016
1025
|
else {
|
1017
1026
|
module.error(error.noTemplate, false);
|
@@ -1177,7 +1186,7 @@ $.fn.search = function(parameters) {
|
|
1177
1186
|
else if(found !== undefined) {
|
1178
1187
|
response = found;
|
1179
1188
|
}
|
1180
|
-
if(
|
1189
|
+
if(Array.isArray(returnedValue)) {
|
1181
1190
|
returnedValue.push(response);
|
1182
1191
|
}
|
1183
1192
|
else if(returnedValue !== undefined) {
|
@@ -1269,6 +1278,9 @@ $.fn.search.settings = {
|
|
1269
1278
|
// whether no results errors should be shown
|
1270
1279
|
showNoResults : true,
|
1271
1280
|
|
1281
|
+
// preserve possible html of resultset values
|
1282
|
+
preserveHTML : true,
|
1283
|
+
|
1272
1284
|
// transition settings
|
1273
1285
|
transition : 'scale',
|
1274
1286
|
duration : 200,
|
@@ -1346,7 +1358,10 @@ $.fn.search.settings = {
|
|
1346
1358
|
},
|
1347
1359
|
|
1348
1360
|
templates: {
|
1349
|
-
escape: function(string) {
|
1361
|
+
escape: function(string, preserveHTML) {
|
1362
|
+
if (preserveHTML){
|
1363
|
+
return string;
|
1364
|
+
}
|
1350
1365
|
var
|
1351
1366
|
badChars = /[&<>"'`]/g,
|
1352
1367
|
shouldEscape = /[&<>"'`]/,
|
@@ -1385,7 +1400,7 @@ $.fn.search.settings = {
|
|
1385
1400
|
}
|
1386
1401
|
return html;
|
1387
1402
|
},
|
1388
|
-
category: function(response, fields) {
|
1403
|
+
category: function(response, fields, preserveHTML) {
|
1389
1404
|
var
|
1390
1405
|
html = '',
|
1391
1406
|
escape = $.fn.search.settings.templates.escape
|
@@ -1399,14 +1414,14 @@ $.fn.search.settings = {
|
|
1399
1414
|
html += '<div class="category">';
|
1400
1415
|
|
1401
1416
|
if(category[fields.categoryName] !== undefined) {
|
1402
|
-
html += '<div class="name">' + category[fields.categoryName] + '</div>';
|
1417
|
+
html += '<div class="name">' + escape(category[fields.categoryName], preserveHTML) + '</div>';
|
1403
1418
|
}
|
1404
1419
|
|
1405
1420
|
// each item inside category
|
1406
1421
|
html += '<div class="results">';
|
1407
1422
|
$.each(category.results, function(index, result) {
|
1408
1423
|
if(result[fields.url]) {
|
1409
|
-
html += '<a class="result" href="' + result[fields.url] + '">';
|
1424
|
+
html += '<a class="result" href="' + result[fields.url].replace(/"/g,"") + '">';
|
1410
1425
|
}
|
1411
1426
|
else {
|
1412
1427
|
html += '<a class="result">';
|
@@ -1414,19 +1429,19 @@ $.fn.search.settings = {
|
|
1414
1429
|
if(result[fields.image] !== undefined) {
|
1415
1430
|
html += ''
|
1416
1431
|
+ '<div class="image">'
|
1417
|
-
+ ' <img src="' + result[fields.image] + '">'
|
1432
|
+
+ ' <img src="' + result[fields.image].replace(/"/g,"") + '">'
|
1418
1433
|
+ '</div>'
|
1419
1434
|
;
|
1420
1435
|
}
|
1421
1436
|
html += '<div class="content">';
|
1422
1437
|
if(result[fields.price] !== undefined) {
|
1423
|
-
html += '<div class="price">' + result[fields.price] + '</div>';
|
1438
|
+
html += '<div class="price">' + escape(result[fields.price], preserveHTML) + '</div>';
|
1424
1439
|
}
|
1425
1440
|
if(result[fields.title] !== undefined) {
|
1426
|
-
html += '<div class="title">' + result[fields.title] + '</div>';
|
1441
|
+
html += '<div class="title">' + escape(result[fields.title], preserveHTML) + '</div>';
|
1427
1442
|
}
|
1428
1443
|
if(result[fields.description] !== undefined) {
|
1429
|
-
html += '<div class="description">' + result[fields.description] + '</div>';
|
1444
|
+
html += '<div class="description">' + escape(result[fields.description], preserveHTML) + '</div>';
|
1430
1445
|
}
|
1431
1446
|
html += ''
|
1432
1447
|
+ '</div>'
|
@@ -1443,12 +1458,12 @@ $.fn.search.settings = {
|
|
1443
1458
|
if(fields.actionURL === false) {
|
1444
1459
|
html += ''
|
1445
1460
|
+ '<div class="action">'
|
1446
|
-
+ response[fields.action][fields.actionText]
|
1461
|
+
+ escape(response[fields.action][fields.actionText], preserveHTML)
|
1447
1462
|
+ '</div>';
|
1448
1463
|
} else {
|
1449
1464
|
html += ''
|
1450
|
-
+ '<a href="' + response[fields.action][fields.actionURL] + '" class="action">'
|
1451
|
-
+ response[fields.action][fields.actionText]
|
1465
|
+
+ '<a href="' + response[fields.action][fields.actionURL].replace(/"/g,"") + '" class="action">'
|
1466
|
+
+ escape(response[fields.action][fields.actionText], preserveHTML)
|
1452
1467
|
+ '</a>';
|
1453
1468
|
}
|
1454
1469
|
}
|
@@ -1456,16 +1471,17 @@ $.fn.search.settings = {
|
|
1456
1471
|
}
|
1457
1472
|
return false;
|
1458
1473
|
},
|
1459
|
-
standard: function(response, fields) {
|
1474
|
+
standard: function(response, fields, preserveHTML) {
|
1460
1475
|
var
|
1461
|
-
html = ''
|
1476
|
+
html = '',
|
1477
|
+
escape = $.fn.search.settings.templates.escape
|
1462
1478
|
;
|
1463
1479
|
if(response[fields.results] !== undefined) {
|
1464
1480
|
|
1465
1481
|
// each result
|
1466
1482
|
$.each(response[fields.results], function(index, result) {
|
1467
1483
|
if(result[fields.url]) {
|
1468
|
-
html += '<a class="result" href="' + result[fields.url] + '">';
|
1484
|
+
html += '<a class="result" href="' + result[fields.url].replace(/"/g,"") + '">';
|
1469
1485
|
}
|
1470
1486
|
else {
|
1471
1487
|
html += '<a class="result">';
|
@@ -1473,19 +1489,19 @@ $.fn.search.settings = {
|
|
1473
1489
|
if(result[fields.image] !== undefined) {
|
1474
1490
|
html += ''
|
1475
1491
|
+ '<div class="image">'
|
1476
|
-
+ ' <img src="' + result[fields.image] + '">'
|
1492
|
+
+ ' <img src="' + result[fields.image].replace(/"/g,"") + '">'
|
1477
1493
|
+ '</div>'
|
1478
1494
|
;
|
1479
1495
|
}
|
1480
1496
|
html += '<div class="content">';
|
1481
1497
|
if(result[fields.price] !== undefined) {
|
1482
|
-
html += '<div class="price">' + result[fields.price] + '</div>';
|
1498
|
+
html += '<div class="price">' + escape(result[fields.price], preserveHTML) + '</div>';
|
1483
1499
|
}
|
1484
1500
|
if(result[fields.title] !== undefined) {
|
1485
|
-
html += '<div class="title">' + result[fields.title] + '</div>';
|
1501
|
+
html += '<div class="title">' + escape(result[fields.title], preserveHTML) + '</div>';
|
1486
1502
|
}
|
1487
1503
|
if(result[fields.description] !== undefined) {
|
1488
|
-
html += '<div class="description">' + result[fields.description] + '</div>';
|
1504
|
+
html += '<div class="description">' + escape(result[fields.description], preserveHTML) + '</div>';
|
1489
1505
|
}
|
1490
1506
|
html += ''
|
1491
1507
|
+ '</div>'
|
@@ -1496,12 +1512,12 @@ $.fn.search.settings = {
|
|
1496
1512
|
if(fields.actionURL === false) {
|
1497
1513
|
html += ''
|
1498
1514
|
+ '<div class="action">'
|
1499
|
-
+ response[fields.action][fields.actionText]
|
1515
|
+
+ escape(response[fields.action][fields.actionText], preserveHTML)
|
1500
1516
|
+ '</div>';
|
1501
1517
|
} else {
|
1502
1518
|
html += ''
|
1503
|
-
+ '<a href="' + response[fields.action][fields.actionURL] + '" class="action">'
|
1504
|
-
+ response[fields.action][fields.actionText]
|
1519
|
+
+ '<a href="' + response[fields.action][fields.actionURL].replace(/"/g,"") + '" class="action">'
|
1520
|
+
+ escape(response[fields.action][fields.actionText], preserveHTML)
|
1505
1521
|
+ '</a>';
|
1506
1522
|
}
|
1507
1523
|
}
|
@@ -12,6 +12,10 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
+
$.isFunction = $.isFunction || function(obj) {
|
16
|
+
return typeof obj === "function" && typeof obj.nodeType !== "number";
|
17
|
+
};
|
18
|
+
|
15
19
|
window = (typeof window != 'undefined' && window.Math == Math)
|
16
20
|
? window
|
17
21
|
: (typeof self != 'undefined' && self.Math == Math)
|
@@ -822,7 +826,7 @@ $.fn.shape = function(parameters) {
|
|
822
826
|
else if(found !== undefined) {
|
823
827
|
response = found;
|
824
828
|
}
|
825
|
-
if(
|
829
|
+
if(Array.isArray(returnedValue)) {
|
826
830
|
returnedValue.push(response);
|
827
831
|
}
|
828
832
|
else if(returnedValue !== undefined) {
|
@@ -12,6 +12,10 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
+
$.isFunction = $.isFunction || function(obj) {
|
16
|
+
return typeof obj === "function" && typeof obj.nodeType !== "number";
|
17
|
+
};
|
18
|
+
|
15
19
|
window = (typeof window != 'undefined' && window.Math == Math)
|
16
20
|
? window
|
17
21
|
: (typeof self != 'undefined' && self.Math == Math)
|
@@ -275,8 +279,8 @@ $.fn.sidebar = function(parameters) {
|
|
275
279
|
style += ''
|
276
280
|
+ ' body.pushable > .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher:after,'
|
277
281
|
+ ' body.pushable > .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher:after {'
|
278
|
-
+ ' -webkit-transform: translate3d(
|
279
|
-
+ ' transform: translate3d(
|
282
|
+
+ ' -webkit-transform: translate3d(0, 0, 0);'
|
283
|
+
+ ' transform: translate3d(0, 0, 0);'
|
280
284
|
+ ' }'
|
281
285
|
;
|
282
286
|
}
|
@@ -913,7 +917,7 @@ $.fn.sidebar = function(parameters) {
|
|
913
917
|
else if(found !== undefined) {
|
914
918
|
response = found;
|
915
919
|
}
|
916
|
-
if(
|
920
|
+
if(Array.isArray(returnedValue)) {
|
917
921
|
returnedValue.push(response);
|
918
922
|
}
|
919
923
|
else if(returnedValue !== undefined) {
|
@@ -10,6 +10,10 @@
|
|
10
10
|
|
11
11
|
;(function ($, window, document, undefined) {
|
12
12
|
|
13
|
+
$.isFunction = $.isFunction || function(obj) {
|
14
|
+
return typeof obj === "function" && typeof obj.nodeType !== "number";
|
15
|
+
};
|
16
|
+
|
13
17
|
$.site = $.fn.site = function(parameters) {
|
14
18
|
var
|
15
19
|
time = new Date().getTime(),
|
@@ -391,7 +395,7 @@ $.site = $.fn.site = function(parameters) {
|
|
391
395
|
else if(found !== undefined) {
|
392
396
|
response = found;
|
393
397
|
}
|
394
|
-
if(
|
398
|
+
if(Array.isArray(returnedValue)) {
|
395
399
|
returnedValue.push(response);
|
396
400
|
}
|
397
401
|
else if(returnedValue !== undefined) {
|
@@ -448,7 +452,7 @@ $.site.settings = {
|
|
448
452
|
'modal',
|
449
453
|
'nag',
|
450
454
|
'popup',
|
451
|
-
'
|
455
|
+
'slider',
|
452
456
|
'rating',
|
453
457
|
'shape',
|
454
458
|
'sidebar',
|
@@ -0,0 +1,1216 @@
|
|
1
|
+
/*!
|
2
|
+
* # Semantic UI - Slider
|
3
|
+
* http://github.com/semantic-org/semantic-ui/
|
4
|
+
*
|
5
|
+
*
|
6
|
+
* Released under the MIT license
|
7
|
+
* http://opensource.org/licenses/MIT
|
8
|
+
*
|
9
|
+
*/
|
10
|
+
|
11
|
+
;(function ( $, window, document, undefined ) {
|
12
|
+
|
13
|
+
"use strict";
|
14
|
+
|
15
|
+
window = (typeof window != 'undefined' && window.Math == Math)
|
16
|
+
? window
|
17
|
+
: (typeof self != 'undefined' && self.Math == Math)
|
18
|
+
? self
|
19
|
+
: Function('return this')()
|
20
|
+
;
|
21
|
+
|
22
|
+
$.fn.slider = function(parameters) {
|
23
|
+
|
24
|
+
var
|
25
|
+
$allModules = $(this),
|
26
|
+
|
27
|
+
moduleSelector = $allModules.selector || '',
|
28
|
+
|
29
|
+
time = new Date().getTime(),
|
30
|
+
performance = [],
|
31
|
+
|
32
|
+
query = arguments[0],
|
33
|
+
methodInvoked = (typeof query == 'string'),
|
34
|
+
queryArguments = [].slice.call(arguments, 1),
|
35
|
+
|
36
|
+
alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],
|
37
|
+
|
38
|
+
SINGLE_STEP = 1,
|
39
|
+
BIG_STEP = 2,
|
40
|
+
NO_STEP = 0,
|
41
|
+
SINGLE_BACKSTEP = -1,
|
42
|
+
BIG_BACKSTEP = -2,
|
43
|
+
|
44
|
+
// Used to manage document bound events.
|
45
|
+
// Use this so that we can distinguish between which document events are bound to which range.
|
46
|
+
currentRange = 0,
|
47
|
+
|
48
|
+
returnedValue
|
49
|
+
;
|
50
|
+
|
51
|
+
$allModules
|
52
|
+
.each(function() {
|
53
|
+
|
54
|
+
var
|
55
|
+
settings = ( $.isPlainObject(parameters) )
|
56
|
+
? $.extend(true, {}, $.fn.slider.settings, parameters)
|
57
|
+
: $.extend({}, $.fn.slider.settings),
|
58
|
+
|
59
|
+
className = settings.className,
|
60
|
+
metadata = settings.metadata,
|
61
|
+
namespace = settings.namespace,
|
62
|
+
error = settings.error,
|
63
|
+
keys = settings.keys,
|
64
|
+
interpretLabel = settings.interpretLabel,
|
65
|
+
|
66
|
+
isHover = false,
|
67
|
+
eventNamespace = '.' + namespace,
|
68
|
+
moduleNamespace = 'module-' + namespace,
|
69
|
+
|
70
|
+
$module = $(this),
|
71
|
+
$currThumb,
|
72
|
+
$thumb,
|
73
|
+
$secondThumb,
|
74
|
+
$track,
|
75
|
+
$trackFill,
|
76
|
+
$labels,
|
77
|
+
|
78
|
+
element = this,
|
79
|
+
instance = $module.data(moduleNamespace),
|
80
|
+
|
81
|
+
documentEventID,
|
82
|
+
|
83
|
+
value,
|
84
|
+
position,
|
85
|
+
secondPos,
|
86
|
+
offset,
|
87
|
+
precision,
|
88
|
+
isTouch,
|
89
|
+
|
90
|
+
module
|
91
|
+
;
|
92
|
+
|
93
|
+
module = {
|
94
|
+
|
95
|
+
initialize: function() {
|
96
|
+
module.debug('Initializing slider', settings);
|
97
|
+
|
98
|
+
currentRange += 1;
|
99
|
+
documentEventID = currentRange;
|
100
|
+
|
101
|
+
isTouch = module.setup.testOutTouch();
|
102
|
+
module.setup.layout();
|
103
|
+
module.setup.labels();
|
104
|
+
|
105
|
+
if(!module.is.disabled()) {
|
106
|
+
module.bind.events();
|
107
|
+
}
|
108
|
+
|
109
|
+
module.read.metadata();
|
110
|
+
module.read.settings();
|
111
|
+
|
112
|
+
module.instantiate();
|
113
|
+
},
|
114
|
+
|
115
|
+
instantiate: function() {
|
116
|
+
module.verbose('Storing instance of slider', module);
|
117
|
+
instance = module;
|
118
|
+
$module
|
119
|
+
.data(moduleNamespace, module)
|
120
|
+
;
|
121
|
+
},
|
122
|
+
|
123
|
+
destroy: function() {
|
124
|
+
module.verbose('Destroying previous slider for', $module);
|
125
|
+
clearInterval(instance.interval);
|
126
|
+
module.unbind.events();
|
127
|
+
module.unbind.slidingEvents();
|
128
|
+
$module.removeData(moduleNamespace);
|
129
|
+
instance = undefined;
|
130
|
+
},
|
131
|
+
|
132
|
+
setup: {
|
133
|
+
layout: function() {
|
134
|
+
if( $module.attr('tabindex') === undefined) {
|
135
|
+
$module.attr('tabindex', 0);
|
136
|
+
}
|
137
|
+
if($module.find('.inner').length == 0) {
|
138
|
+
$module.append("<div class='inner'>"
|
139
|
+
+ "<div class='track'></div>"
|
140
|
+
+ "<div class='track-fill'></div>"
|
141
|
+
+ "<div class='thumb'></div>"
|
142
|
+
+ "</div>");
|
143
|
+
}
|
144
|
+
precision = module.get.precision();
|
145
|
+
$thumb = $module.find('.thumb:not(.second)');
|
146
|
+
$currThumb = $thumb;
|
147
|
+
if(module.is.range()) {
|
148
|
+
if($module.find('.thumb.second').length == 0) {
|
149
|
+
$module.find('.inner').append("<div class='thumb second'></div>");
|
150
|
+
}
|
151
|
+
$secondThumb = $module.find('.thumb.second');
|
152
|
+
}
|
153
|
+
$track = $module.find('.track');
|
154
|
+
$trackFill = $module.find('.track-fill');
|
155
|
+
offset = $thumb.width() / 2;
|
156
|
+
},
|
157
|
+
labels: function() {
|
158
|
+
if(module.is.labeled()) {
|
159
|
+
$labels = $module.find('.labels:not(.auto)');
|
160
|
+
if($labels.length != 0) {
|
161
|
+
module.setup.customLabel();
|
162
|
+
} else {
|
163
|
+
module.setup.autoLabel();
|
164
|
+
}
|
165
|
+
|
166
|
+
if (settings.showLabelTicks) {
|
167
|
+
$module.addClass(className.ticked)
|
168
|
+
}
|
169
|
+
}
|
170
|
+
},
|
171
|
+
testOutTouch: function() {
|
172
|
+
try {
|
173
|
+
document.createEvent('TouchEvent');
|
174
|
+
return true;
|
175
|
+
} catch (e) {
|
176
|
+
return false;
|
177
|
+
}
|
178
|
+
},
|
179
|
+
customLabel: function() {
|
180
|
+
var
|
181
|
+
$children = $labels.find('.label'),
|
182
|
+
numChildren = $children.length,
|
183
|
+
min = module.get.min(),
|
184
|
+
max = module.get.max(),
|
185
|
+
ratio
|
186
|
+
;
|
187
|
+
$children.each(function(index) {
|
188
|
+
var
|
189
|
+
$child = $(this),
|
190
|
+
attrValue = $child.attr('data-value')
|
191
|
+
;
|
192
|
+
if(attrValue) {
|
193
|
+
attrValue = attrValue > max ? max : attrValue < min ? min : attrValue;
|
194
|
+
ratio = (attrValue - min) / (max - min);
|
195
|
+
} else {
|
196
|
+
ratio = (index + 1) / (numChildren + 1);
|
197
|
+
}
|
198
|
+
module.update.labelPosition(ratio, $(this));
|
199
|
+
});
|
200
|
+
},
|
201
|
+
autoLabel: function() {
|
202
|
+
if(module.get.step() != 0) {
|
203
|
+
$labels = $module.find('.labels');
|
204
|
+
if($labels.length != 0) {
|
205
|
+
$labels.empty();
|
206
|
+
}
|
207
|
+
else {
|
208
|
+
$labels = $module.append('<ul class="auto labels"></ul>').find('.labels');
|
209
|
+
}
|
210
|
+
for(var i = 0, len = module.get.numLabels(); i <= len; i++) {
|
211
|
+
var
|
212
|
+
labelText = module.get.label(i),
|
213
|
+
$label = (labelText !== "") ? $('<li class="label">' + labelText + '</li>') : null,
|
214
|
+
ratio = i / len
|
215
|
+
;
|
216
|
+
if($label) {
|
217
|
+
module.update.labelPosition(ratio, $label);
|
218
|
+
$labels.append($label);
|
219
|
+
}
|
220
|
+
}
|
221
|
+
}
|
222
|
+
}
|
223
|
+
},
|
224
|
+
|
225
|
+
bind: {
|
226
|
+
events: function() {
|
227
|
+
module.bind.globalKeyboardEvents();
|
228
|
+
module.bind.keyboardEvents();
|
229
|
+
module.bind.mouseEvents();
|
230
|
+
if(module.is.touch()) {
|
231
|
+
module.bind.touchEvents();
|
232
|
+
}
|
233
|
+
},
|
234
|
+
keyboardEvents: function() {
|
235
|
+
module.verbose('Binding keyboard events');
|
236
|
+
$module.on('keydown' + eventNamespace, module.event.keydown);
|
237
|
+
},
|
238
|
+
globalKeyboardEvents: function() {
|
239
|
+
$(document).on('keydown' + eventNamespace + documentEventID, module.event.activateFocus);
|
240
|
+
},
|
241
|
+
mouseEvents: function() {
|
242
|
+
module.verbose('Binding mouse events');
|
243
|
+
$module.find('.track, .thumb, .inner').on('mousedown' + eventNamespace, function(event) {
|
244
|
+
event.stopImmediatePropagation();
|
245
|
+
event.preventDefault();
|
246
|
+
module.event.down(event);
|
247
|
+
});
|
248
|
+
$module.on('mousedown' + eventNamespace, module.event.down);
|
249
|
+
$module.on('mouseenter' + eventNamespace, function(event) {
|
250
|
+
isHover = true;
|
251
|
+
});
|
252
|
+
$module.on('mouseleave' + eventNamespace, function(event) {
|
253
|
+
isHover = false;
|
254
|
+
});
|
255
|
+
},
|
256
|
+
touchEvents: function() {
|
257
|
+
module.verbose('Binding touch events');
|
258
|
+
$module.find('.track, .thumb, .inner').on('touchstart' + eventNamespace, function(event) {
|
259
|
+
event.stopImmediatePropagation();
|
260
|
+
event.preventDefault();
|
261
|
+
module.event.down(event);
|
262
|
+
});
|
263
|
+
$module.on('touchstart' + eventNamespace, module.event.down);
|
264
|
+
},
|
265
|
+
slidingEvents: function() {
|
266
|
+
// these don't need the identifier because we only ever want one of them to be registered with document
|
267
|
+
module.verbose('Binding page wide events while handle is being draged');
|
268
|
+
if(module.is.touch()) {
|
269
|
+
$(document).on('touchmove' + eventNamespace, module.event.move);
|
270
|
+
$(document).on('touchend' + eventNamespace, module.event.up);
|
271
|
+
}
|
272
|
+
else {
|
273
|
+
$(document).on('mousemove' + eventNamespace, module.event.move);
|
274
|
+
$(document).on('mouseup' + eventNamespace, module.event.up);
|
275
|
+
}
|
276
|
+
}
|
277
|
+
},
|
278
|
+
|
279
|
+
unbind: {
|
280
|
+
events: function() {
|
281
|
+
$module.find('.track, .thumb, .inner').off('mousedown' + eventNamespace);
|
282
|
+
$module.find('.track, .thumb, .inner').off('touchstart' + eventNamespace);
|
283
|
+
$module.off('mousedown' + eventNamespace);
|
284
|
+
$module.off('mouseenter' + eventNamespace);
|
285
|
+
$module.off('mouseleave' + eventNamespace);
|
286
|
+
$module.off('touchstart' + eventNamespace);
|
287
|
+
$module.off('keydown' + eventNamespace);
|
288
|
+
$module.off('focusout' + eventNamespace);
|
289
|
+
$(document).off('keydown' + eventNamespace + documentEventID, module.event.activateFocus);
|
290
|
+
},
|
291
|
+
slidingEvents: function() {
|
292
|
+
if(module.is.touch()) {
|
293
|
+
$(document).off('touchmove' + eventNamespace);
|
294
|
+
$(document).off('touchend' + eventNamespace);
|
295
|
+
} else {
|
296
|
+
$(document).off('mousemove' + eventNamespace);
|
297
|
+
$(document).off('mouseup' + eventNamespace);
|
298
|
+
}
|
299
|
+
},
|
300
|
+
},
|
301
|
+
|
302
|
+
event: {
|
303
|
+
down: function(event, originalEvent) {
|
304
|
+
event.preventDefault();
|
305
|
+
if(module.is.range()) {
|
306
|
+
var
|
307
|
+
eventPos = module.determine.eventPos(event, originalEvent),
|
308
|
+
newPos = module.determine.pos(eventPos)
|
309
|
+
;
|
310
|
+
$currThumb = module.determine.closestThumb(newPos);
|
311
|
+
}
|
312
|
+
if(!module.is.disabled()) {
|
313
|
+
module.bind.slidingEvents();
|
314
|
+
}
|
315
|
+
},
|
316
|
+
move: function(event, originalEvent) {
|
317
|
+
event.preventDefault();
|
318
|
+
var value = module.determine.valueFromEvent(event, originalEvent);
|
319
|
+
if(module.get.step() == 0 || module.is.smooth()) {
|
320
|
+
var
|
321
|
+
thumbVal = module.thumbVal,
|
322
|
+
secondThumbVal = module.secondThumbVal,
|
323
|
+
thumbSmoothVal = module.determine.smoothValueFromEvent(event, originalEvent)
|
324
|
+
;
|
325
|
+
if(!$currThumb.hasClass('second')) {
|
326
|
+
thumbVal = value;
|
327
|
+
} else {
|
328
|
+
secondThumbVal = value;
|
329
|
+
}
|
330
|
+
value = Math.abs(thumbVal - (secondThumbVal || 0));
|
331
|
+
module.update.position(thumbSmoothVal);
|
332
|
+
settings.onMove.call(element, value, thumbVal, secondThumbVal);
|
333
|
+
} else {
|
334
|
+
module.update.value(value, function(value, thumbVal, secondThumbVal) {
|
335
|
+
settings.onMove.call(element, value, thumbVal, secondThumbVal);
|
336
|
+
});
|
337
|
+
}
|
338
|
+
},
|
339
|
+
up: function(event, originalEvent) {
|
340
|
+
event.preventDefault();
|
341
|
+
var value = module.determine.valueFromEvent(event, originalEvent);
|
342
|
+
module.set.value(value);
|
343
|
+
module.unbind.slidingEvents();
|
344
|
+
},
|
345
|
+
keydown: function(event, first) {
|
346
|
+
if(module.is.focused()) {
|
347
|
+
$(document).trigger(event);
|
348
|
+
}
|
349
|
+
if(first || module.is.focused()) {
|
350
|
+
var step = module.determine.keyMovement(event);
|
351
|
+
if(step != NO_STEP) {
|
352
|
+
event.preventDefault();
|
353
|
+
switch(step) {
|
354
|
+
case SINGLE_STEP:
|
355
|
+
module.takeStep();
|
356
|
+
break;
|
357
|
+
case BIG_STEP:
|
358
|
+
module.takeStep(module.get.multiplier());
|
359
|
+
break;
|
360
|
+
case SINGLE_BACKSTEP:
|
361
|
+
module.backStep();
|
362
|
+
break;
|
363
|
+
case BIG_BACKSTEP:
|
364
|
+
module.backStep(module.get.multiplier());
|
365
|
+
break;
|
366
|
+
}
|
367
|
+
}
|
368
|
+
}
|
369
|
+
},
|
370
|
+
activateFocus: function(event) {
|
371
|
+
if(!module.is.focused() && module.is.hover() && module.determine.keyMovement(event) != NO_STEP) {
|
372
|
+
event.preventDefault();
|
373
|
+
module.event.keydown(event, true);
|
374
|
+
$module.focus();
|
375
|
+
}
|
376
|
+
},
|
377
|
+
},
|
378
|
+
|
379
|
+
resync: function() {
|
380
|
+
module.verbose('Resyncing thumb position based on value');
|
381
|
+
if(module.is.range()) {
|
382
|
+
module.update.position(module.secondThumbVal, $secondThumb);
|
383
|
+
}
|
384
|
+
module.update.position(module.thumbVal, $thumb);
|
385
|
+
module.setup.labels();
|
386
|
+
},
|
387
|
+
takeStep: function(multiplier) {
|
388
|
+
var
|
389
|
+
multiplier = multiplier != undefined ? multiplier : 1,
|
390
|
+
step = module.get.step(),
|
391
|
+
currValue = module.get.currentThumbValue()
|
392
|
+
;
|
393
|
+
module.verbose('Taking a step');
|
394
|
+
if(step > 0) {
|
395
|
+
module.set.value(currValue + step * multiplier);
|
396
|
+
} else if (step == 0){
|
397
|
+
var
|
398
|
+
precision = module.get.precision(),
|
399
|
+
newValue = currValue + (multiplier/precision)
|
400
|
+
;
|
401
|
+
module.set.value(Math.round(newValue * precision) / precision);
|
402
|
+
}
|
403
|
+
},
|
404
|
+
|
405
|
+
backStep: function(multiplier) {
|
406
|
+
var
|
407
|
+
multiplier = multiplier != undefined ? multiplier : 1,
|
408
|
+
step = module.get.step(),
|
409
|
+
currValue = module.get.currentThumbValue()
|
410
|
+
;
|
411
|
+
module.verbose('Going back a step');
|
412
|
+
if(step > 0) {
|
413
|
+
module.set.value(currValue - step * multiplier);
|
414
|
+
} else if (step == 0) {
|
415
|
+
var
|
416
|
+
precision = module.get.precision(),
|
417
|
+
newValue = currValue - (multiplier/precision)
|
418
|
+
;
|
419
|
+
module.set.value(Math.round(newValue * precision) / precision);
|
420
|
+
}
|
421
|
+
},
|
422
|
+
|
423
|
+
is: {
|
424
|
+
range: function() {
|
425
|
+
return $module.hasClass(settings.className.range);
|
426
|
+
},
|
427
|
+
hover: function() {
|
428
|
+
return isHover;
|
429
|
+
},
|
430
|
+
focused: function() {
|
431
|
+
return $module.is(':focus');
|
432
|
+
},
|
433
|
+
disabled: function() {
|
434
|
+
return $module.hasClass(settings.className.disabled);
|
435
|
+
},
|
436
|
+
labeled: function() {
|
437
|
+
return $module.hasClass(settings.className.labeled);
|
438
|
+
},
|
439
|
+
reversed: function() {
|
440
|
+
return $module.hasClass(settings.className.reversed);
|
441
|
+
},
|
442
|
+
vertical: function() {
|
443
|
+
return $module.hasClass(settings.className.vertical);
|
444
|
+
},
|
445
|
+
smooth: function() {
|
446
|
+
return settings.smooth || $module.hasClass(settings.className.smooth);
|
447
|
+
},
|
448
|
+
touch: function() {
|
449
|
+
return isTouch;
|
450
|
+
}
|
451
|
+
},
|
452
|
+
|
453
|
+
get: {
|
454
|
+
trackOffset: function() {
|
455
|
+
if (module.is.vertical()) {
|
456
|
+
return $track.offset().top;
|
457
|
+
} else {
|
458
|
+
return $track.offset().left;
|
459
|
+
}
|
460
|
+
},
|
461
|
+
trackLength: function() {
|
462
|
+
if (module.is.vertical()) {
|
463
|
+
return $track.height();
|
464
|
+
} else {
|
465
|
+
return $track.width();
|
466
|
+
}
|
467
|
+
},
|
468
|
+
trackLeft: function() {
|
469
|
+
if (module.is.vertical()) {
|
470
|
+
return $track.position().top;
|
471
|
+
} else {
|
472
|
+
return $track.position().left;
|
473
|
+
}
|
474
|
+
},
|
475
|
+
trackStartPos: function() {
|
476
|
+
return module.is.reversed() ? module.get.trackLeft() + module.get.trackLength() : module.get.trackLeft();
|
477
|
+
},
|
478
|
+
trackEndPos: function() {
|
479
|
+
return module.is.reversed() ? module.get.trackLeft() : module.get.trackLeft() + module.get.trackLength();
|
480
|
+
},
|
481
|
+
trackStartMargin: function () {
|
482
|
+
var margin;
|
483
|
+
if (module.is.vertical()) {
|
484
|
+
margin = module.is.reversed() ? $module.css('padding-bottom') : $module.css('padding-top');
|
485
|
+
} else {
|
486
|
+
margin = module.is.reversed() ? $module.css('padding-right') : $module.css('padding-left');
|
487
|
+
}
|
488
|
+
return margin || '0px';
|
489
|
+
},
|
490
|
+
trackEndMargin: function () {
|
491
|
+
var margin;
|
492
|
+
if (module.is.vertical()) {
|
493
|
+
margin = module.is.reversed() ? $module.css('padding-top') : $module.css('padding-bottom');
|
494
|
+
} else {
|
495
|
+
margin = module.is.reversed() ? $module.css('padding-left') : $module.css('padding-right');
|
496
|
+
}
|
497
|
+
return margin || '0px';
|
498
|
+
},
|
499
|
+
precision: function() {
|
500
|
+
var
|
501
|
+
decimalPlaces,
|
502
|
+
step = module.get.step()
|
503
|
+
;
|
504
|
+
if(step != 0) {
|
505
|
+
var split = String(step).split('.');
|
506
|
+
if(split.length == 2) {
|
507
|
+
decimalPlaces = split[1].length;
|
508
|
+
} else {
|
509
|
+
decimalPlaces = 0;
|
510
|
+
}
|
511
|
+
} else {
|
512
|
+
decimalPlaces = settings.decimalPlaces;
|
513
|
+
}
|
514
|
+
var precision = Math.pow(10, decimalPlaces);
|
515
|
+
module.debug('Precision determined', precision);
|
516
|
+
return precision;
|
517
|
+
},
|
518
|
+
min: function() {
|
519
|
+
return settings.min;
|
520
|
+
},
|
521
|
+
max: function() {
|
522
|
+
return settings.max;
|
523
|
+
},
|
524
|
+
step: function() {
|
525
|
+
return settings.step;
|
526
|
+
},
|
527
|
+
numLabels: function() {
|
528
|
+
var value = Math.round((module.get.max() - module.get.min()) / module.get.step());
|
529
|
+
module.debug('Determined that their should be ' + value + ' labels');
|
530
|
+
return value;
|
531
|
+
},
|
532
|
+
labelType: function() {
|
533
|
+
return settings.labelType;
|
534
|
+
},
|
535
|
+
label: function(value) {
|
536
|
+
if(interpretLabel) {
|
537
|
+
return interpretLabel(value);
|
538
|
+
}
|
539
|
+
|
540
|
+
switch (settings.labelType) {
|
541
|
+
case settings.labelTypes.number:
|
542
|
+
return (value * module.get.step()) + module.get.min();
|
543
|
+
case settings.labelTypes.letter:
|
544
|
+
return alphabet[(value) % 26];
|
545
|
+
default:
|
546
|
+
return value;
|
547
|
+
}
|
548
|
+
},
|
549
|
+
value: function() {
|
550
|
+
return value;
|
551
|
+
},
|
552
|
+
currentThumbValue: function() {
|
553
|
+
return $currThumb.hasClass('second') ? module.secondThumbVal : module.thumbVal;
|
554
|
+
},
|
555
|
+
thumbValue: function(which) {
|
556
|
+
switch(which) {
|
557
|
+
case 'second':
|
558
|
+
if(module.is.range()) {
|
559
|
+
return module.secondThumbVal;
|
560
|
+
}
|
561
|
+
else {
|
562
|
+
module.error(error.notrange);
|
563
|
+
break;
|
564
|
+
}
|
565
|
+
case 'first':
|
566
|
+
default:
|
567
|
+
return module.thumbVal;
|
568
|
+
}
|
569
|
+
},
|
570
|
+
multiplier: function() {
|
571
|
+
return settings.pageMultiplier;
|
572
|
+
},
|
573
|
+
thumbPosition: function(which) {
|
574
|
+
switch(which) {
|
575
|
+
case 'second':
|
576
|
+
if(module.is.range()) {
|
577
|
+
return secondPos;
|
578
|
+
}
|
579
|
+
else {
|
580
|
+
module.error(error.notrange);
|
581
|
+
break;
|
582
|
+
}
|
583
|
+
case 'first':
|
584
|
+
default:
|
585
|
+
return position;
|
586
|
+
}
|
587
|
+
}
|
588
|
+
},
|
589
|
+
|
590
|
+
determine: {
|
591
|
+
pos: function(pagePos) {
|
592
|
+
return module.is.reversed()
|
593
|
+
?
|
594
|
+
module.get.trackStartPos() - pagePos + module.get.trackOffset()
|
595
|
+
:
|
596
|
+
pagePos - module.get.trackOffset() - module.get.trackStartPos()
|
597
|
+
;
|
598
|
+
},
|
599
|
+
closestThumb: function(eventPos) {
|
600
|
+
var
|
601
|
+
thumbPos = parseFloat(module.determine.thumbPos($thumb)),
|
602
|
+
thumbDelta = Math.abs(eventPos - thumbPos),
|
603
|
+
secondThumbPos = parseFloat(module.determine.thumbPos($secondThumb)),
|
604
|
+
secondThumbDelta = Math.abs(eventPos - secondThumbPos)
|
605
|
+
;
|
606
|
+
return thumbDelta <= secondThumbDelta ? $thumb : $secondThumb;
|
607
|
+
},
|
608
|
+
closestThumbPos: function(eventPos) {
|
609
|
+
var
|
610
|
+
thumbPos = parseFloat(module.determine.thumbPos($thumb)),
|
611
|
+
thumbDelta = Math.abs(eventPos - thumbPos),
|
612
|
+
secondThumbPos = parseFloat(module.determine.thumbPos($secondThumb)),
|
613
|
+
secondThumbDelta = Math.abs(eventPos - secondThumbPos)
|
614
|
+
;
|
615
|
+
return thumbDelta <= secondThumbDelta ? thumbPos : secondThumbPos;
|
616
|
+
},
|
617
|
+
thumbPos: function($element) {
|
618
|
+
var pos =
|
619
|
+
module.is.vertical()
|
620
|
+
?
|
621
|
+
module.is.reversed() ? $element.css('bottom') : $element.css('top')
|
622
|
+
:
|
623
|
+
module.is.reversed() ? $element.css('right') : $element.css('left')
|
624
|
+
;
|
625
|
+
return pos;
|
626
|
+
},
|
627
|
+
positionFromValue: function(value) {
|
628
|
+
var
|
629
|
+
min = module.get.min(),
|
630
|
+
max = module.get.max(),
|
631
|
+
value = value > max ? max : value < min ? min : value,
|
632
|
+
trackLength = module.get.trackLength(),
|
633
|
+
ratio = (value - min) / (max - min),
|
634
|
+
position = Math.round(ratio * trackLength)
|
635
|
+
;
|
636
|
+
module.verbose('Determined position: ' + position + ' from value: ' + value);
|
637
|
+
return position;
|
638
|
+
},
|
639
|
+
positionFromRatio: function(ratio) {
|
640
|
+
var
|
641
|
+
trackLength = module.get.trackLength(),
|
642
|
+
step = module.get.step(),
|
643
|
+
position = Math.round(ratio * trackLength),
|
644
|
+
adjustedPos = (step == 0) ? position : Math.round(position / step) * step
|
645
|
+
;
|
646
|
+
return adjustedPos;
|
647
|
+
},
|
648
|
+
valueFromEvent: function(event, originalEvent) {
|
649
|
+
var
|
650
|
+
eventPos = module.determine.eventPos(event, originalEvent),
|
651
|
+
newPos = module.determine.pos(eventPos),
|
652
|
+
value
|
653
|
+
;
|
654
|
+
if(eventPos < module.get.trackOffset()) {
|
655
|
+
value = module.is.reversed() ? module.get.max() : module.get.min();
|
656
|
+
} else if(eventPos > module.get.trackOffset() + module.get.trackLength()) {
|
657
|
+
value = module.is.reversed() ? module.get.min() : module.get.max();
|
658
|
+
} else {
|
659
|
+
value = module.determine.value(newPos);
|
660
|
+
}
|
661
|
+
return value;
|
662
|
+
},
|
663
|
+
smoothValueFromEvent: function(event, originalEvent) {
|
664
|
+
var
|
665
|
+
min = module.get.min(),
|
666
|
+
max = module.get.max(),
|
667
|
+
trackLength = module.get.trackLength(),
|
668
|
+
eventPos = module.determine.eventPos(event, originalEvent),
|
669
|
+
newPos = eventPos - module.get.trackOffset(),
|
670
|
+
ratio,
|
671
|
+
value
|
672
|
+
;
|
673
|
+
newPos = newPos < 0 ? 0 : newPos > trackLength ? trackLength : newPos;
|
674
|
+
ratio = newPos / trackLength;
|
675
|
+
if (module.is.reversed()) {
|
676
|
+
ratio = 1 - ratio;
|
677
|
+
}
|
678
|
+
value = ratio * (max - min) + min;
|
679
|
+
return value;
|
680
|
+
},
|
681
|
+
eventPos: function(event, originalEvent) {
|
682
|
+
if(module.is.touch()) {
|
683
|
+
var
|
684
|
+
touchY = event.changedTouches[0].pageY || event.touches[0].pageY,
|
685
|
+
touchX = event.changedTouches[0].pageX || event.touches[0].pageX
|
686
|
+
;
|
687
|
+
return module.is.vertical() ? touchY : touchX;
|
688
|
+
}
|
689
|
+
var
|
690
|
+
clickY = event.pageY || originalEvent.pageY,
|
691
|
+
clickX = event.pageX || originalEvent.pageX
|
692
|
+
;
|
693
|
+
return module.is.vertical() ? clickY : clickX;
|
694
|
+
},
|
695
|
+
value: function(position) {
|
696
|
+
var
|
697
|
+
startPos = module.is.reversed() ? module.get.trackEndPos() : module.get.trackStartPos(),
|
698
|
+
endPos = module.is.reversed() ? module.get.trackStartPos() : module.get.trackEndPos(),
|
699
|
+
ratio = (position - startPos) / (endPos - startPos),
|
700
|
+
range = module.get.max() - module.get.min(),
|
701
|
+
step = module.get.step(),
|
702
|
+
value = (ratio * range),
|
703
|
+
difference = (step == 0) ? value : Math.round(value / step) * step
|
704
|
+
;
|
705
|
+
module.verbose('Determined value based upon position: ' + position + ' as: ' + value);
|
706
|
+
if(value != difference) {
|
707
|
+
module.verbose('Rounding value to closest step: ' + difference);
|
708
|
+
}
|
709
|
+
// Use precision to avoid ugly Javascript floating point rounding issues
|
710
|
+
// (like 35 * .01 = 0.35000000000000003)
|
711
|
+
difference = Math.round(difference * precision) / precision;
|
712
|
+
module.verbose('Cutting off additional decimal places');
|
713
|
+
return difference + module.get.min();
|
714
|
+
},
|
715
|
+
keyMovement: function(event) {
|
716
|
+
var
|
717
|
+
key = event.which,
|
718
|
+
downArrow =
|
719
|
+
module.is.vertical()
|
720
|
+
?
|
721
|
+
module.is.reversed() ? keys.downArrow : keys.upArrow
|
722
|
+
:
|
723
|
+
keys.downArrow
|
724
|
+
,
|
725
|
+
upArrow =
|
726
|
+
module.is.vertical()
|
727
|
+
?
|
728
|
+
module.is.reversed() ? keys.upArrow : keys.downArrow
|
729
|
+
:
|
730
|
+
keys.upArrow
|
731
|
+
,
|
732
|
+
leftArrow =
|
733
|
+
!module.is.vertical()
|
734
|
+
?
|
735
|
+
module.is.reversed() ? keys.rightArrow : keys.leftArrow
|
736
|
+
:
|
737
|
+
keys.leftArrow
|
738
|
+
,
|
739
|
+
rightArrow =
|
740
|
+
!module.is.vertical()
|
741
|
+
?
|
742
|
+
module.is.reversed() ? keys.leftArrow : keys.rightArrow
|
743
|
+
:
|
744
|
+
keys.rightArrow
|
745
|
+
;
|
746
|
+
if(key == downArrow || key == leftArrow) {
|
747
|
+
return SINGLE_BACKSTEP;
|
748
|
+
} else if(key == upArrow || key == rightArrow) {
|
749
|
+
return SINGLE_STEP;
|
750
|
+
} else if (key == keys.pageDown) {
|
751
|
+
return BIG_BACKSTEP;
|
752
|
+
} else if (key == keys.pageUp) {
|
753
|
+
return BIG_STEP;
|
754
|
+
} else {
|
755
|
+
return NO_STEP;
|
756
|
+
}
|
757
|
+
}
|
758
|
+
},
|
759
|
+
|
760
|
+
handleNewValuePosition: function(val) {
|
761
|
+
var
|
762
|
+
min = module.get.min(),
|
763
|
+
max = module.get.max(),
|
764
|
+
newPos
|
765
|
+
;
|
766
|
+
if (val <= min) {
|
767
|
+
val = min;
|
768
|
+
} else if (val >= max) {
|
769
|
+
val = max;
|
770
|
+
}
|
771
|
+
newPos = module.determine.positionFromValue(val);
|
772
|
+
return newPos;
|
773
|
+
},
|
774
|
+
|
775
|
+
set: {
|
776
|
+
value: function(newValue) {
|
777
|
+
module.update.value(newValue, function(value, thumbVal, secondThumbVal) {
|
778
|
+
settings.onChange.call(element, value, thumbVal, secondThumbVal);
|
779
|
+
settings.onMove.call(element, value, thumbVal, secondThumbVal);
|
780
|
+
});
|
781
|
+
},
|
782
|
+
rangeValue: function(first, second) {
|
783
|
+
if(module.is.range()) {
|
784
|
+
var
|
785
|
+
min = module.get.min(),
|
786
|
+
max = module.get.max()
|
787
|
+
;
|
788
|
+
if (first <= min) {
|
789
|
+
first = min;
|
790
|
+
} else if(first >= max){
|
791
|
+
first = max;
|
792
|
+
}
|
793
|
+
if (second <= min) {
|
794
|
+
second = min;
|
795
|
+
} else if(second >= max){
|
796
|
+
second = max;
|
797
|
+
}
|
798
|
+
module.thumbVal = first;
|
799
|
+
module.secondThumbVal = second;
|
800
|
+
value = Math.abs(module.thumbVal - module.secondThumbVal);
|
801
|
+
module.update.position(module.thumbVal, $thumb);
|
802
|
+
module.update.position(module.secondThumbVal, $secondThumb);
|
803
|
+
settings.onChange.call(element, value, module.thumbVal, module.secondThumbVal);
|
804
|
+
settings.onMove.call(element, value, module.thumbVal, module.secondThumbVal);
|
805
|
+
} else {
|
806
|
+
module.error(error.notrange);
|
807
|
+
}
|
808
|
+
},
|
809
|
+
position: function(position, which) {
|
810
|
+
var thumbVal = module.determine.value(position);
|
811
|
+
switch (which) {
|
812
|
+
case 'second':
|
813
|
+
module.secondThumbVal = thumbVal;
|
814
|
+
module.update.position(thumbVal, $secondThumb);
|
815
|
+
break;
|
816
|
+
default:
|
817
|
+
module.thumbVal = thumbVal;
|
818
|
+
module.update.position(thumbVal, $thumb);
|
819
|
+
}
|
820
|
+
value = Math.abs(module.thumbVal - (module.secondThumbVal || 0));
|
821
|
+
module.set.value(value);
|
822
|
+
}
|
823
|
+
},
|
824
|
+
|
825
|
+
update: {
|
826
|
+
value: function(newValue, callback) {
|
827
|
+
var
|
828
|
+
min = module.get.min(),
|
829
|
+
max = module.get.max()
|
830
|
+
;
|
831
|
+
if (newValue <= min) {
|
832
|
+
newValue = min;
|
833
|
+
} else if(newValue >= max){
|
834
|
+
newValue = max;
|
835
|
+
}
|
836
|
+
if(!module.is.range()) {
|
837
|
+
value = newValue;
|
838
|
+
module.thumbVal = value;
|
839
|
+
} else {
|
840
|
+
if(!$currThumb.hasClass('second')) {
|
841
|
+
module.thumbVal = newValue;
|
842
|
+
} else {
|
843
|
+
module.secondThumbVal = newValue;
|
844
|
+
}
|
845
|
+
value = Math.abs(module.thumbVal - module.secondThumbVal);
|
846
|
+
}
|
847
|
+
module.update.position(newValue);
|
848
|
+
module.debug('Setting slider value to ' + value);
|
849
|
+
if(typeof callback === 'function') {
|
850
|
+
callback(value, module.thumbVal, module.secondThumbVal);
|
851
|
+
}
|
852
|
+
},
|
853
|
+
position: function(newValue, $element) {
|
854
|
+
var
|
855
|
+
newPos = module.handleNewValuePosition(newValue),
|
856
|
+
$targetThumb = $element != undefined ? $element : $currThumb,
|
857
|
+
thumbVal = module.thumbVal || module.get.min(),
|
858
|
+
secondThumbVal = module.secondThumbVal || module.get.min()
|
859
|
+
;
|
860
|
+
if(module.is.range()) {
|
861
|
+
if(!$targetThumb.hasClass('second')) {
|
862
|
+
position = newPos;
|
863
|
+
thumbVal = newValue;
|
864
|
+
} else {
|
865
|
+
secondPos = newPos;
|
866
|
+
secondThumbVal = newValue;
|
867
|
+
}
|
868
|
+
} else {
|
869
|
+
position = newPos;
|
870
|
+
thumbVal = newValue;
|
871
|
+
}
|
872
|
+
var
|
873
|
+
trackPosValue,
|
874
|
+
thumbPosValue,
|
875
|
+
min = module.get.min(),
|
876
|
+
max = module.get.max(),
|
877
|
+
thumbPosPercent = 100 * (newValue - min) / (max - min),
|
878
|
+
trackStartPosPercent = 100 * (Math.min(thumbVal, secondThumbVal) - min) / (max - min),
|
879
|
+
trackEndPosPercent = 100 * (1 - (Math.max(thumbVal, secondThumbVal) - min) / (max - min))
|
880
|
+
;
|
881
|
+
if (module.is.vertical()) {
|
882
|
+
if (module.is.reversed()) {
|
883
|
+
thumbPosValue = {bottom: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', top: 'auto'};
|
884
|
+
trackPosValue = {bottom: trackStartPosPercent + '%', top: trackEndPosPercent + '%'};
|
885
|
+
}
|
886
|
+
else {
|
887
|
+
thumbPosValue = {top: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', bottom: 'auto'};
|
888
|
+
trackPosValue = {top: trackStartPosPercent + '%', bottom: trackEndPosPercent + '%'};
|
889
|
+
}
|
890
|
+
} else {
|
891
|
+
if (module.is.reversed()) {
|
892
|
+
thumbPosValue = {right: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', left: 'auto'};
|
893
|
+
trackPosValue = {right: trackStartPosPercent + '%', left: trackEndPosPercent + '%'};
|
894
|
+
}
|
895
|
+
else {
|
896
|
+
thumbPosValue = {left: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', right: 'auto'};
|
897
|
+
trackPosValue = {left: trackStartPosPercent + '%', right: trackEndPosPercent + '%'};
|
898
|
+
}
|
899
|
+
}
|
900
|
+
$targetThumb.css(thumbPosValue);
|
901
|
+
$trackFill.css(trackPosValue);
|
902
|
+
module.debug('Setting slider position to ' + newPos);
|
903
|
+
},
|
904
|
+
labelPosition: function (ratio, $label) {
|
905
|
+
var
|
906
|
+
startMargin = module.get.trackStartMargin(),
|
907
|
+
endMargin = module.get.trackEndMargin(),
|
908
|
+
posDir =
|
909
|
+
module.is.vertical()
|
910
|
+
?
|
911
|
+
module.is.reversed() ? 'bottom' : 'top'
|
912
|
+
:
|
913
|
+
module.is.reversed() ? 'right' : 'left',
|
914
|
+
startMarginMod = module.is.reversed() && !module.is.vertical() ? ' - ' : ' + '
|
915
|
+
;
|
916
|
+
var position = '(100% - ' + startMargin + ' - ' + endMargin + ') * ' + ratio;
|
917
|
+
$label.css(posDir, 'calc(' + position + startMarginMod + startMargin + ')');
|
918
|
+
}
|
919
|
+
},
|
920
|
+
|
921
|
+
goto: {
|
922
|
+
max: function() {
|
923
|
+
module.set.value(module.get.max());
|
924
|
+
},
|
925
|
+
min: function() {
|
926
|
+
module.set.value(module.get.min());
|
927
|
+
},
|
928
|
+
},
|
929
|
+
|
930
|
+
read: {
|
931
|
+
metadata: function() {
|
932
|
+
var
|
933
|
+
data = {
|
934
|
+
thumbVal : $module.data(metadata.thumbVal),
|
935
|
+
secondThumbVal : $module.data(metadata.secondThumbVal)
|
936
|
+
}
|
937
|
+
;
|
938
|
+
if(data.thumbVal) {
|
939
|
+
if(module.is.range() && data.secondThumbVal) {
|
940
|
+
module.debug('Current value set from metadata', data.thumbVal, data.secondThumbVal);
|
941
|
+
module.set.rangeValue(data.thumbVal, data.secondThumbVal);
|
942
|
+
} else {
|
943
|
+
module.debug('Current value set from metadata', data.thumbVal);
|
944
|
+
module.set.value(data.thumbVal);
|
945
|
+
}
|
946
|
+
}
|
947
|
+
},
|
948
|
+
settings: function() {
|
949
|
+
if(settings.start !== false) {
|
950
|
+
if(module.is.range()) {
|
951
|
+
module.debug('Start position set from settings', settings.start, settings.end);
|
952
|
+
module.set.rangeValue(settings.start, settings.end);
|
953
|
+
} else {
|
954
|
+
module.debug('Start position set from settings', settings.start);
|
955
|
+
module.set.value(settings.start);
|
956
|
+
}
|
957
|
+
}
|
958
|
+
}
|
959
|
+
},
|
960
|
+
|
961
|
+
setting: function(name, value) {
|
962
|
+
module.debug('Changing setting', name, value);
|
963
|
+
if( $.isPlainObject(name) ) {
|
964
|
+
$.extend(true, settings, name);
|
965
|
+
}
|
966
|
+
else if(value !== undefined) {
|
967
|
+
if($.isPlainObject(settings[name])) {
|
968
|
+
$.extend(true, settings[name], value);
|
969
|
+
}
|
970
|
+
else {
|
971
|
+
settings[name] = value;
|
972
|
+
}
|
973
|
+
}
|
974
|
+
else {
|
975
|
+
return settings[name];
|
976
|
+
}
|
977
|
+
},
|
978
|
+
internal: function(name, value) {
|
979
|
+
if( $.isPlainObject(name) ) {
|
980
|
+
$.extend(true, module, name);
|
981
|
+
}
|
982
|
+
else if(value !== undefined) {
|
983
|
+
module[name] = value;
|
984
|
+
}
|
985
|
+
else {
|
986
|
+
return module[name];
|
987
|
+
}
|
988
|
+
},
|
989
|
+
debug: function() {
|
990
|
+
if(!settings.silent && settings.debug) {
|
991
|
+
if(settings.performance) {
|
992
|
+
module.performance.log(arguments);
|
993
|
+
}
|
994
|
+
else {
|
995
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
996
|
+
module.debug.apply(console, arguments);
|
997
|
+
}
|
998
|
+
}
|
999
|
+
},
|
1000
|
+
verbose: function() {
|
1001
|
+
if(!settings.silent && settings.verbose && settings.debug) {
|
1002
|
+
if(settings.performance) {
|
1003
|
+
module.performance.log(arguments);
|
1004
|
+
}
|
1005
|
+
else {
|
1006
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
1007
|
+
module.verbose.apply(console, arguments);
|
1008
|
+
}
|
1009
|
+
}
|
1010
|
+
},
|
1011
|
+
error: function() {
|
1012
|
+
if(!settings.silent) {
|
1013
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
1014
|
+
module.error.apply(console, arguments);
|
1015
|
+
}
|
1016
|
+
},
|
1017
|
+
|
1018
|
+
performance: {
|
1019
|
+
log: function(message) {
|
1020
|
+
var
|
1021
|
+
currentTime,
|
1022
|
+
executionTime,
|
1023
|
+
previousTime
|
1024
|
+
;
|
1025
|
+
if(settings.performance) {
|
1026
|
+
currentTime = new Date().getTime();
|
1027
|
+
previousTime = time || currentTime;
|
1028
|
+
executionTime = currentTime - previousTime;
|
1029
|
+
time = currentTime;
|
1030
|
+
performance.push({
|
1031
|
+
'Name' : message[0],
|
1032
|
+
'Arguments' : [].slice.call(message, 1) || '',
|
1033
|
+
'Element' : element,
|
1034
|
+
'Execution Time' : executionTime
|
1035
|
+
});
|
1036
|
+
}
|
1037
|
+
clearTimeout(module.performance.timer);
|
1038
|
+
module.performance.timer = setTimeout(module.performance.display, 500);
|
1039
|
+
},
|
1040
|
+
display: function() {
|
1041
|
+
var
|
1042
|
+
title = settings.name + ':',
|
1043
|
+
totalTime = 0
|
1044
|
+
;
|
1045
|
+
time = false;
|
1046
|
+
clearTimeout(module.performance.timer);
|
1047
|
+
$.each(performance, function(index, data) {
|
1048
|
+
totalTime += data['Execution Time'];
|
1049
|
+
});
|
1050
|
+
title += ' ' + totalTime + 'ms';
|
1051
|
+
if(moduleSelector) {
|
1052
|
+
title += ' \'' + moduleSelector + '\'';
|
1053
|
+
}
|
1054
|
+
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
1055
|
+
console.groupCollapsed(title);
|
1056
|
+
if(console.table) {
|
1057
|
+
console.table(performance);
|
1058
|
+
}
|
1059
|
+
else {
|
1060
|
+
$.each(performance, function(index, data) {
|
1061
|
+
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
1062
|
+
});
|
1063
|
+
}
|
1064
|
+
console.groupEnd();
|
1065
|
+
}
|
1066
|
+
performance = [];
|
1067
|
+
}
|
1068
|
+
},
|
1069
|
+
|
1070
|
+
invoke: function(query, passedArguments, context) {
|
1071
|
+
var
|
1072
|
+
object = instance,
|
1073
|
+
maxDepth,
|
1074
|
+
found,
|
1075
|
+
response
|
1076
|
+
;
|
1077
|
+
passedArguments = passedArguments || queryArguments;
|
1078
|
+
context = element || context;
|
1079
|
+
if(typeof query == 'string' && object !== undefined) {
|
1080
|
+
query = query.split(/[\. ]/);
|
1081
|
+
maxDepth = query.length - 1;
|
1082
|
+
$.each(query, function(depth, value) {
|
1083
|
+
var camelCaseValue = (depth != maxDepth)
|
1084
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
1085
|
+
: query
|
1086
|
+
;
|
1087
|
+
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
1088
|
+
object = object[camelCaseValue];
|
1089
|
+
}
|
1090
|
+
else if( object[camelCaseValue] !== undefined ) {
|
1091
|
+
found = object[camelCaseValue];
|
1092
|
+
return false;
|
1093
|
+
}
|
1094
|
+
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
1095
|
+
object = object[value];
|
1096
|
+
}
|
1097
|
+
else if( object[value] !== undefined ) {
|
1098
|
+
found = object[value];
|
1099
|
+
return false;
|
1100
|
+
}
|
1101
|
+
else {
|
1102
|
+
module.error(error.method, query);
|
1103
|
+
return false;
|
1104
|
+
}
|
1105
|
+
});
|
1106
|
+
}
|
1107
|
+
if ( $.isFunction( found ) ) {
|
1108
|
+
response = found.apply(context, passedArguments);
|
1109
|
+
}
|
1110
|
+
else if(found !== undefined) {
|
1111
|
+
response = found;
|
1112
|
+
}
|
1113
|
+
if($.isArray(returnedValue)) {
|
1114
|
+
returnedValue.push(response);
|
1115
|
+
}
|
1116
|
+
else if(returnedValue !== undefined) {
|
1117
|
+
returnedValue = [returnedValue, response];
|
1118
|
+
}
|
1119
|
+
else if(response !== undefined) {
|
1120
|
+
returnedValue = response;
|
1121
|
+
}
|
1122
|
+
return found;
|
1123
|
+
}
|
1124
|
+
};
|
1125
|
+
|
1126
|
+
if(methodInvoked) {
|
1127
|
+
if(instance === undefined) {
|
1128
|
+
module.initialize();
|
1129
|
+
}
|
1130
|
+
module.invoke(query);
|
1131
|
+
}
|
1132
|
+
else {
|
1133
|
+
if(instance !== undefined) {
|
1134
|
+
instance.invoke('destroy');
|
1135
|
+
}
|
1136
|
+
module.initialize();
|
1137
|
+
}
|
1138
|
+
})
|
1139
|
+
;
|
1140
|
+
|
1141
|
+
return (returnedValue !== undefined)
|
1142
|
+
? returnedValue
|
1143
|
+
: this
|
1144
|
+
;
|
1145
|
+
|
1146
|
+
};
|
1147
|
+
|
1148
|
+
$.fn.slider.settings = {
|
1149
|
+
|
1150
|
+
silent : false,
|
1151
|
+
debug : false,
|
1152
|
+
verbose : false,
|
1153
|
+
performance : true,
|
1154
|
+
|
1155
|
+
name : 'Slider',
|
1156
|
+
namespace : 'slider',
|
1157
|
+
|
1158
|
+
error : {
|
1159
|
+
method : 'The method you called is not defined.',
|
1160
|
+
notrange : 'This slider is not a range slider'
|
1161
|
+
},
|
1162
|
+
|
1163
|
+
metadata: {
|
1164
|
+
thumbVal : 'thumbVal',
|
1165
|
+
secondThumbVal : 'secondThumbVal'
|
1166
|
+
},
|
1167
|
+
|
1168
|
+
min : 0,
|
1169
|
+
max : 20,
|
1170
|
+
step : 1,
|
1171
|
+
start : 0,
|
1172
|
+
end : 20,
|
1173
|
+
labelType : 'number',
|
1174
|
+
showLabelTicks : false,
|
1175
|
+
smooth : false,
|
1176
|
+
|
1177
|
+
//the decimal place to round to if step is undefined
|
1178
|
+
decimalPlaces : 2,
|
1179
|
+
|
1180
|
+
// page up/down multiplier. How many more times the steps to take on page up/down press
|
1181
|
+
pageMultiplier : 2,
|
1182
|
+
|
1183
|
+
selector: {
|
1184
|
+
|
1185
|
+
},
|
1186
|
+
|
1187
|
+
className : {
|
1188
|
+
reversed : 'reversed',
|
1189
|
+
disabled : 'disabled',
|
1190
|
+
labeled : 'labeled',
|
1191
|
+
ticked : 'ticked',
|
1192
|
+
vertical : 'vertical',
|
1193
|
+
range : 'range',
|
1194
|
+
smooth : 'smooth'
|
1195
|
+
},
|
1196
|
+
|
1197
|
+
keys : {
|
1198
|
+
pageUp : 33,
|
1199
|
+
pageDown : 34,
|
1200
|
+
leftArrow : 37,
|
1201
|
+
upArrow : 38,
|
1202
|
+
rightArrow : 39,
|
1203
|
+
downArrow : 40
|
1204
|
+
},
|
1205
|
+
|
1206
|
+
labelTypes : {
|
1207
|
+
number : 'number',
|
1208
|
+
letter : 'letter'
|
1209
|
+
},
|
1210
|
+
|
1211
|
+
onChange : function(value, thumbVal, secondThumbVal){},
|
1212
|
+
onMove : function(value, thumbVal, secondThumbVal){},
|
1213
|
+
};
|
1214
|
+
|
1215
|
+
|
1216
|
+
})( jQuery, window, document );
|