right-rails 1.0.10 → 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -4
- data/Rakefile +4 -4
- data/lib/right_rails.rb +1 -1
- data/public/javascripts/right/autocompleter-src.js +115 -106
- data/public/javascripts/right/autocompleter.js +3 -14
- data/public/javascripts/right/billboard-src.js +58 -38
- data/public/javascripts/right/billboard.js +3 -13
- data/public/javascripts/right/calendar-src.js +136 -133
- data/public/javascripts/right/calendar.js +4 -33
- data/public/javascripts/right/colorpicker-src.js +128 -125
- data/public/javascripts/right/colorpicker.js +4 -23
- data/public/javascripts/right/dialog-src.js +67 -37
- data/public/javascripts/right/dialog.js +3 -17
- data/public/javascripts/right/dnd-src.js +44 -43
- data/public/javascripts/right/dnd.js +3 -16
- data/public/javascripts/right/effects-src.js +125 -98
- data/public/javascripts/right/effects.js +3 -13
- data/public/javascripts/right/in-edit-src.js +54 -38
- data/public/javascripts/right/in-edit.js +4 -10
- data/public/javascripts/right/jquerysh-src.js +344 -20
- data/public/javascripts/right/jquerysh.js +3 -3
- data/public/javascripts/right/json-src.js +22 -35
- data/public/javascripts/right/json.js +4 -7
- data/public/javascripts/right/keys-src.js +87 -0
- data/public/javascripts/right/keys.js +7 -0
- data/public/javascripts/right/lightbox-src.js +76 -58
- data/public/javascripts/right/lightbox.js +3 -20
- data/public/javascripts/right/rails-src.js +108 -107
- data/public/javascripts/right/rails.js +4 -11
- data/public/javascripts/right/rater-src.js +47 -31
- data/public/javascripts/right/rater.js +3 -9
- data/public/javascripts/right/resizable-src.js +60 -33
- data/public/javascripts/right/resizable.js +3 -11
- data/public/javascripts/right/selectable-src.js +87 -51
- data/public/javascripts/right/selectable.js +3 -18
- data/public/javascripts/right/sizzle-src.js +15 -10
- data/public/javascripts/right/sizzle.js +4 -27
- data/public/javascripts/right/slider-src.js +49 -33
- data/public/javascripts/right/slider.js +3 -10
- data/public/javascripts/right/sortable-src.js +46 -32
- data/public/javascripts/right/sortable.js +4 -13
- data/public/javascripts/right/table-src.js +19 -10
- data/public/javascripts/right/table.js +4 -6
- data/public/javascripts/right/tabs-src.js +69 -47
- data/public/javascripts/right/tabs.js +4 -26
- data/public/javascripts/right/tooltips-src.js +78 -56
- data/public/javascripts/right/tooltips.js +4 -9
- data/public/javascripts/right/uploader-src.js +50 -34
- data/public/javascripts/right/uploader.js +3 -9
- data/public/javascripts/right-olds-src.js +528 -355
- data/public/javascripts/right-olds.js +4 -13
- data/public/javascripts/right-safe-src.js +4 -99
- data/public/javascripts/right-safe.js +3 -4
- data/public/javascripts/right-src.js +1618 -1245
- data/public/javascripts/right.js +4 -91
- metadata +8 -6
@@ -1,30 +1,7 @@
|
|
1
1
|
/**
|
2
|
-
* Sizzle
|
2
|
+
* Sizzle Engine Support v2.2.0
|
3
|
+
* http://rightjs.org/plugins/sizzle
|
3
4
|
*
|
4
|
-
* Copyright (C)
|
5
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
5
6
|
*/
|
6
|
-
(function(){function o(a,b,d,c,e,f){e=0;for(var g=c.length;e<g;e++){var h=c[e];if(h){h=h[a];for(var k=false;h;){if(h.sizcache===d){k=c[h.sizset];break}if(h.nodeType===1&&!f){h.sizcache=d;h.sizset=e}if(h.nodeName.toLowerCase()===b){k=h;break}h=h[a]}c[e]=k}}}function z(a,b,d,c,e,f){e=0;for(var g=c.length;e<g;e++){var h=c[e];if(h){h=h[a];for(var k=false;h;){if(h.sizcache===d){k=c[h.sizset];break}if(h.nodeType===1){if(!f){h.sizcache=d;h.sizset=e}if(typeof b!=="string"){if(h===b){k=true;break}}else if(j.filter(b,
|
7
|
-
[h]).length>0){k=h;break}}h=h[a]}c[e]=k}}}var x=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,y=0,A=Object.prototype.toString,t=false,B=true;[0,0].sort(function(){B=false;return 0});var j=function(a,b,d,c){d=d||[];var e=b=b||document;if(b.nodeType!==1&&b.nodeType!==9)return[];if(!a||typeof a!=="string")return d;var f=[],g,h,k,q,m=true,p=j.isXML(b),n=a,l;do{x.exec("");if(g=x.exec(n)){n=g[3];f.push(g[1]);if(g[2]){q=
|
8
|
-
g[3];break}}}while(g);if(f.length>1&&E.exec(a))if(f.length===2&&i.relative[f[0]])h=C(f[0]+f[1],b);else for(h=i.relative[f[0]]?[b]:j(f.shift(),b);f.length;){a=f.shift();if(i.relative[a])a+=f.shift();h=C(a,h)}else{if(!c&&f.length>1&&b.nodeType===9&&!p&&i.match.ID.test(f[0])&&!i.match.ID.test(f[f.length-1])){g=j.find(f.shift(),b,p);b=g.expr?j.filter(g.expr,g.set)[0]:g.set[0]}if(b){g=c?{expr:f.pop(),set:r(c)}:j.find(f.pop(),f.length===1&&(f[0]==="~"||f[0]==="+")&&b.parentNode?b.parentNode:b,p);h=g.expr?
|
9
|
-
j.filter(g.expr,g.set):g.set;if(f.length>0)k=r(h);else m=false;for(;f.length;){g=l=f.pop();if(i.relative[l])g=f.pop();else l="";if(g==null)g=b;i.relative[l](k,g,p)}}else k=[]}k||(k=h);k||j.error(l||a);if(A.call(k)==="[object Array]")if(m)if(b&&b.nodeType===1)for(a=0;k[a]!=null;a++){if(k[a]&&(k[a]===true||k[a].nodeType===1&&j.contains(b,k[a])))d.push(h[a])}else for(a=0;k[a]!=null;a++)k[a]&&k[a].nodeType===1&&d.push(h[a]);else d.push.apply(d,k);else r(k,d);if(q){j(q,e,d,c);j.uniqueSort(d)}return d};
|
10
|
-
j.uniqueSort=function(a){if(u){t=B;a.sort(u);if(t)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a};j.matches=function(a,b){return j(a,null,null,b)};j.find=function(a,b,d){var c;if(!a)return[];for(var e=0,f=i.order.length;e<f;e++){var g=i.order[e],h;if(h=i.leftMatch[g].exec(a)){var k=h[1];h.splice(1,1);if(k.substr(k.length-1)!=="\\"){h[1]=(h[1]||"").replace(/\\/g,"");c=i.find[g](h,b,d);if(c!=null){a=a.replace(i.match[g],"");break}}}}c||(c=b.getElementsByTagName("*"));return{set:c,
|
11
|
-
expr:a}};j.filter=function(a,b,d,c){for(var e=a,f=[],g=b,h,k,q=b&&b[0]&&j.isXML(b[0]);a&&b.length;){for(var m in i.filter)if((h=i.leftMatch[m].exec(a))!=null&&h[2]){var p=i.filter[m],n,l;l=h[1];k=false;h.splice(1,1);if(l.substr(l.length-1)!=="\\"){if(g===f)f=[];if(i.preFilter[m])if(h=i.preFilter[m](h,g,d,f,c,q)){if(h===true)continue}else k=n=true;if(h)for(var v=0;(l=g[v])!=null;v++)if(l){n=p(l,h,v,g);var D=c^!!n;if(d&&n!=null)if(D)k=true;else g[v]=false;else if(D){f.push(l);k=true}}if(n!==undefined){d||
|
12
|
-
(g=f);a=a.replace(i.match[m],"");if(!k)return[];break}}}if(a===e)if(k==null)j.error(a);else break;e=a}return g};j.error=function(a){throw"Syntax error, unrecognized expression: "+a;};var i=j.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
|
13
|
-
POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")}},relative:{"+":function(a,b){var d=typeof b==="string",c=d&&!/\W/.test(b);d=d&&!c;if(c)b=b.toLowerCase();c=0;for(var e=a.length,f;c<e;c++)if(f=a[c]){for(;(f=f.previousSibling)&&f.nodeType!==1;);a[c]=d||f&&f.nodeName.toLowerCase()===
|
14
|
-
b?f||false:f===b}d&&j.filter(b,a,true)},">":function(a,b){var d=typeof b==="string",c,e=0,f=a.length;if(d&&!/\W/.test(b))for(b=b.toLowerCase();e<f;e++){if(c=a[e]){d=c.parentNode;a[e]=d.nodeName.toLowerCase()===b?d:false}}else{for(;e<f;e++)if(c=a[e])a[e]=d?c.parentNode:c.parentNode===b;d&&j.filter(b,a,true)}},"":function(a,b,d){var c=y++,e=z,f;if(typeof b==="string"&&!/\W/.test(b)){f=b=b.toLowerCase();e=o}e("parentNode",b,c,a,f,d)},"~":function(a,b,d){var c=y++,e=z,f;if(typeof b==="string"&&!/\W/.test(b)){f=
|
15
|
-
b=b.toLowerCase();e=o}e("previousSibling",b,c,a,f,d)}},find:{ID:function(a,b,d){if(typeof b.getElementById!=="undefined"&&!d)return(a=b.getElementById(a[1]))&&a.parentNode?[a]:[]},NAME:function(a,b){if(typeof b.getElementsByName!=="undefined"){for(var d=[],c=b.getElementsByName(a[1]),e=0,f=c.length;e<f;e++)c[e].getAttribute("name")===a[1]&&d.push(c[e]);return d.length===0?null:d}},TAG:function(a,b){return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,d,c,e,f){a=" "+a[1].replace(/\\/g,
|
16
|
-
"")+" ";if(f)return a;f=0;for(var g;(g=b[f])!=null;f++)if(g)if(e^(g.className&&(" "+g.className+" ").replace(/[\t\n]/g," ").indexOf(a)>=0))d||c.push(g);else if(d)b[f]=false;return false},ID:function(a){return a[1].replace(/\\/g,"")},TAG:function(a){return a[1].toLowerCase()},CHILD:function(a){if(a[1]==="nth"){var b=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0;a[3]=b[3]-0}a[0]=y++;return a},ATTR:function(a,b,d,
|
17
|
-
c,e,f){b=a[1].replace(/\\/g,"");if(!f&&i.attrMap[b])a[1]=i.attrMap[b];if(a[2]==="~=")a[4]=" "+a[4]+" ";return a},PSEUDO:function(a,b,d,c,e){if(a[1]==="not")if((x.exec(a[3])||"").length>1||/^\w/.test(a[3]))a[3]=j(a[3],null,null,b);else{a=j.filter(a[3],b,d,true^e);d||c.push.apply(c,a);return false}else if(i.match.POS.test(a[0])||i.match.CHILD.test(a[0]))return true;return a},POS:function(a){a.unshift(true);return a}},filters:{enabled:function(a){return a.disabled===false&&a.type!=="hidden"},disabled:function(a){return a.disabled===
|
18
|
-
true},checked:function(a){return a.checked===true},selected:function(a){return a.selected===true},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,d){return!!j(d[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){return"text"===a.type},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===
|
19
|
-
a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,d,c){return b===c.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,d){return b<d[3]-0},gt:function(a,b,d){return b>d[3]-0},nth:function(a,b,d){return d[3]-
|
20
|
-
0===b},eq:function(a,b,d){return d[3]-0===b}},filter:{PSEUDO:function(a,b,d,c){var e=b[1],f=i.filters[e];if(f)return f(a,d,b,c);else if(e==="contains")return(a.textContent||a.innerText||j.getText([a])||"").indexOf(b[3])>=0;else if(e==="not"){b=b[3];d=0;for(c=b.length;d<c;d++)if(b[d]===a)return false;return true}else j.error("Syntax error, unrecognized expression: "+e)},CHILD:function(a,b){var d=b[1],c=a;switch(d){case "only":case "first":for(;c=c.previousSibling;)if(c.nodeType===1)return false;if(d===
|
21
|
-
"first")return true;c=a;case "last":for(;c=c.nextSibling;)if(c.nodeType===1)return false;return true;case "nth":d=b[2];var e=b[3];if(d===1&&e===0)return true;var f=b[0],g=a.parentNode;if(g&&(g.sizcache!==f||!a.nodeIndex)){var h=0;for(c=g.firstChild;c;c=c.nextSibling)if(c.nodeType===1)c.nodeIndex=++h;g.sizcache=f}c=a.nodeIndex-e;return d===0?c===0:c%d===0&&c/d>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===
|
22
|
-
b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var d=b[1];d=i.attrHandle[d]?i.attrHandle[d](a):a[d]!=null?a[d]:a.getAttribute(d);var c=d+"",e=b[2],f=b[4];return d==null?e==="!=":e==="="?c===f:e==="*="?c.indexOf(f)>=0:e==="~="?(" "+c+" ").indexOf(f)>=0:!f?c&&d!==false:e==="!="?c!==f:e==="^="?c.indexOf(f)===0:e==="$="?c.substr(c.length-f.length)===f:e==="|="?c===f||c.substr(0,f.length+1)===f+"-":false},POS:function(a,b,d,c){var e=i.setFilters[b[2]];
|
23
|
-
if(e)return e(a,d,b,c)}}},E=i.match.POS,F=function(a,b){return"\\"+(b-0+1)};for(var w in i.match){i.match[w]=RegExp(i.match[w].source+/(?![^\[]*\])(?![^\(]*\))/.source);i.leftMatch[w]=RegExp(/(^(?:.|\r|\n)*?)/.source+i.match[w].source.replace(/\\(\d+)/g,F))}var r=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(document.documentElement.childNodes,0)}catch(G){r=function(a,b){var d=b||[],c=0;if(A.call(a)==="[object Array]")Array.prototype.push.apply(d,
|
24
|
-
a);else if(typeof a.length==="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,s;if(document.documentElement.compareDocumentPosition)u=function(a,b){if(a===b){t=true;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1};else{u=function(a,b){var d=[],c=[],e=a.parentNode,f=b.parentNode,g=e;if(a===b){t=true;return 0}else if(e===f)return s(a,b);else if(e){if(!f)return 1}else return-1;
|
25
|
-
for(;g;){d.unshift(g);g=g.parentNode}for(g=f;g;){c.unshift(g);g=g.parentNode}e=d.length;f=c.length;for(g=0;g<e&&g<f;g++)if(d[g]!==c[g])return s(d[g],c[g]);return g===e?s(a,c[g],-1):s(d[g],b,1)};s=function(a,b,d){if(a===b)return d;for(a=a.nextSibling;a;){if(a===b)return-1;a=a.nextSibling}return 1}}j.getText=function(a){for(var b="",d,c=0;a[c];c++){d=a[c];if(d.nodeType===3||d.nodeType===4)b+=d.nodeValue;else if(d.nodeType!==8)b+=j.getText(d.childNodes)}return b};(function(){var a=document.createElement("div"),
|
26
|
-
b="script"+(new Date).getTime();a.innerHTML="<a name='"+b+"'/>";var d=document.documentElement;d.insertBefore(a,d.firstChild);if(document.getElementById(b)){i.find.ID=function(c,e,f){if(typeof e.getElementById!=="undefined"&&!f)return(e=e.getElementById(c[1]))?e.id===c[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===c[1]?[e]:undefined:[]};i.filter.ID=function(c,e){var f=typeof c.getAttributeNode!=="undefined"&&c.getAttributeNode("id");return c.nodeType===1&&f&&f.nodeValue===
|
27
|
-
e}}d.removeChild(a);d=a=null})();(function(){var a=document.createElement("div");a.appendChild(document.createComment(""));if(a.getElementsByTagName("*").length>0)i.find.TAG=function(b,d){var c=d.getElementsByTagName(b[1]);if(b[1]==="*"){for(var e=[],f=0;c[f];f++)c[f].nodeType===1&&e.push(c[f]);c=e}return c};a.innerHTML="<a href='#'></a>";if(a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#")i.attrHandle.href=function(b){return b.getAttribute("href",
|
28
|
-
2)};a=null})();document.querySelectorAll&&function(){var a=j,b=document.createElement("div");b.innerHTML="<p class='TEST'></p>";if(!(b.querySelectorAll&&b.querySelectorAll(".TEST").length===0)){j=function(c,e,f,g){e=e||document;if(!g&&e.nodeType===9&&!j.isXML(e))try{return r(e.querySelectorAll(c),f)}catch(h){}return a(c,e,f,g)};for(var d in a)j[d]=a[d];b=null}}();(function(){var a=document.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!a.getElementsByClassName||
|
29
|
-
a.getElementsByClassName("e").length===0)){a.lastChild.className="e";if(a.getElementsByClassName("e").length!==1){i.order.splice(1,0,"CLASS");i.find.CLASS=function(b,d,c){if(typeof d.getElementsByClassName!=="undefined"&&!c)return d.getElementsByClassName(b[1])};a=null}}})();j.contains=document.compareDocumentPosition?function(a,b){return!!(a.compareDocumentPosition(b)&16)}:function(a,b){return a!==b&&(a.contains?a.contains(b):true)};j.isXML=function(a){return(a=(a?a.ownerDocument||a:0).documentElement)?
|
30
|
-
a.nodeName!=="HTML":false};var C=function(a,b){for(var d=[],c="",e,f=b.nodeType?[b]:b;e=i.match.PSEUDO.exec(a);){c+=e[0];a=a.replace(i.match.PSEUDO,"")}a=i.relative[a]?a+"*":a;e=0;for(var g=f.length;e<g;e++)j(a,f[e],d);return j.filter(c,d)};window.Sizzle=j})();RightJS([RightJS.Document,RightJS.Element]).each("include",{first:function(o){return this.find(o)[0]},find:function(o){return RightJS(Sizzle(o,this._)).map(RightJS.$)}});
|
7
|
+
RightJS.Sizzle={version:"2.2.0"},function(){function p(a,b,c,d,e,g){for(var h=0,i=d.length;h<i;h++){var j=d[h];if(j){j=j[a];var k=!1;while(j){if(j.sizcache===c){k=d[j.sizset];break}if(j.nodeType===1){g||(j.sizcache=c,j.sizset=h);if(typeof b!=="string"){if(j===b){k=!0;break}}else if(f.filter(b,[j]).length>0){k=j;break}}j=j[a]}d[h]=k}}}function o(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){i=i[a];var j=!1;while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,b=0,c=Object.prototype.toString,d=!1,e=!0;[0,0].sort(function(){e=!1;return 0});var f=function(b,d,e,i){e=e||[],d=d||document;var j=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var l=[],m,n,o,p,r=!0,s=f.isXML(d),t=b,u,v,w,x;do{a.exec(""),m=a.exec(t);if(m){t=m[3],l.push(m[1]);if(m[2]){p=m[3];break}}}while(m);if(l.length>1&&h.exec(b))if(l.length===2&&g.relative[l[0]])n=q(l[0]+l[1],d);else{n=g.relative[l[0]]?[d]:f(l.shift(),d);while(l.length)b=l.shift(),g.relative[b]&&(b+=l.shift()),n=q(b,n)}else{!i&&l.length>1&&d.nodeType===9&&!s&&g.match.ID.test(l[0])&&!g.match.ID.test(l[l.length-1])&&(u=f.find(l.shift(),d,s),d=u.expr?f.filter(u.expr,u.set)[0]:u.set[0]);if(d){u=i?{expr:l.pop(),set:k(i)}:f.find(l.pop(),l.length===1&&(l[0]==="~"||l[0]==="+")&&d.parentNode?d.parentNode:d,s),n=u.expr?f.filter(u.expr,u.set):u.set,l.length>0?o=k(n):r=!1;while(l.length)v=l.pop(),w=v,g.relative[v]?w=l.pop():v="",w==null&&(w=d),g.relative[v](o,w,s)}else o=l=[]}o||(o=n),o||f.error(v||b);if(c.call(o)==="[object Array]")if(r)if(d&&d.nodeType===1)for(x=0;o[x]!=null;x++)o[x]&&(o[x]===!0||o[x].nodeType===1&&f.contains(d,o[x]))&&e.push(n[x]);else for(x=0;o[x]!=null;x++)o[x]&&o[x].nodeType===1&&e.push(n[x]);else e.push.apply(e,o);else k(o,e);p&&(f(p,j,e,i),f.uniqueSort(e));return e};f.uniqueSort=function(a){if(m){d=e,a.sort(m);if(d)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},f.matches=function(a,b){return f(a,null,null,b)},f.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=g.order.length;e<f;e++){var h=g.order[e],i;if(i=g.leftMatch[h].exec(a)){var j=i[1];i.splice(1,1);if(j.substr(j.length-1)!=="\\"){i[1]=(i[1]||"").replace(/\\/g,""),d=g.find[h](i,b,c);if(d!=null){a=a.replace(g.match[h],"");break}}}}d||(d=b.getElementsByTagName("*"));return{set:d,expr:a}},f.filter=function(a,b,c,d){var e=a,h=[],i=b,j,k,l=b&&b[0]&&f.isXML(b[0]);while(a&&b.length){for(var m in g.filter)if((j=g.leftMatch[m].exec(a))!=null&&j[2]){var n=g.filter[m],o,p,q=j[1];k=!1,j.splice(1,1);if(q.substr(q.length-1)==="\\")continue;i===h&&(h=[]);if(g.preFilter[m]){j=g.preFilter[m](j,i,c,h,d,l);if(j){if(j===!0)continue}else k=o=!0}if(j)for(var r=0;(p=i[r])!=null;r++)if(p){o=n(p,j,r,i);var s=d^!!o;c&&o!=null?s?k=!0:i[r]=!1:s&&(h.push(p),k=!0)}if(o!==undefined){c||(i=h),a=a.replace(g.match[m],"");if(!k)return[];break}}if(a===e)if(k==null)f.error(a);else break;e=a}return i},f.error=function(a){throw"Syntax error, unrecognized expression: "+a};var g=f.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")}},relative:{"+":function(a,b){var c=typeof b==="string",d=c&&!/\W/.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var g=0,h=a.length,i;g<h;g++)if(i=a[g]){while((i=i.previousSibling)&&i.nodeType!==1){}a[g]=e||i&&i.nodeName.toLowerCase()===b?i||!1:i===b}e&&f.filter(b,a,!0)},">":function(a,b){var c=typeof b==="string",d,e=0,g=a.length;if(c&&!/\W/.test(b)){b=b.toLowerCase();for(;e<g;e++){d=a[e];if(d){var h=d.parentNode;a[e]=h.nodeName.toLowerCase()===b?h:!1}}}else{for(;e<g;e++)d=a[e],d&&(a[e]=c?d.parentNode:d.parentNode===b);c&&f.filter(b,a,!0)}},"":function(a,c,d){var e=b++,f=p,g;typeof c==="string"&&!/\W/.test(c)&&(c=c.toLowerCase(),g=c,f=o),f("parentNode",c,e,a,g,d)},"~":function(a,c,d){var e=b++,f=p,g;typeof c==="string"&&!/\W/.test(c)&&(c=c.toLowerCase(),g=c,f=o),f("previousSibling",c,e,a,g,d)}},find:{ID:function(a,b,c){if(typeof b.getElementById!=="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!=="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(/\\/g,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(/\\/g,"")},TAG:function(a,b){return a[1].toLowerCase()},CHILD:function(a){if(a[1]==="nth"){var c=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=c[1]+(c[2]||1)-0,a[3]=c[3]-0}a[0]=b++;return a},ATTR:function(a,b,c,d,e,f){var h=a[1].replace(/\\/g,"");!f&&g.attrMap[h]&&(a[1]=g.attrMap[h]),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,h){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=f(b[3],null,null,c);else{var i=f.filter(b[3],c,d,!0^h);d||e.push.apply(e,i);return!1}else if(g.match.POS.test(b[0])||g.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!f(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){return"text"===a.type},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],h=g.filters[e];if(h)return h(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||f.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var i=b[3];for(var j=0,k=i.length;j<k;j++)if(i[j]===a)return!1;return!0}f.error("Syntax error, unrecognized expression: "+e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=g.attrHandle[c]?g.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],h=b[4];return d==null?f==="!=":f==="="?e===h:f==="*="?e.indexOf(h)>=0:f==="~="?(" "+e+" ").indexOf(h)>=0:h?f==="!="?e!==h:f==="^="?e.indexOf(h)===0:f==="$="?e.substr(e.length-h.length)===h:f==="|="?e===h||e.substr(0,h.length+1)===h+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=g.setFilters[e];if(f)return f(a,c,b,d)}}},h=g.match.POS,i=function(a,b){return"\\"+(b-0+1)};for(var j in g.match)g.match[j]=new RegExp(g.match[j].source+/(?![^\[]*\])(?![^\(]*\))/.source),g.leftMatch[j]=new RegExp(/(^(?:.|\r|\n)*?)/.source+g.match[j].source.replace(/\\(\d+)/g,i));var k=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType}catch(l){k=function(a,b){var d=b||[],e=0;if(c.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var f=a.length;e<f;e++)d.push(a[e]);else for(;a[e];e++)d.push(a[e]);return d}}var m,n;document.documentElement.compareDocumentPosition?m=function(a,b){if(a===b){d=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(m=function(a,b){var c=[],e=[],f=a.parentNode,g=b.parentNode,h=f,i,j;if(a===b){d=!0;return 0}if(f===g)return n(a,b);if(!f)return-1;if(!g)return 1;while(h)c.unshift(h),h=h.parentNode;h=g;while(h)e.unshift(h),h=h.parentNode;i=c.length,j=e.length;for(var k=0;k<i&&k<j;k++)if(c[k]!==e[k])return n(c[k],e[k]);return k===i?n(a,e[k],-1):n(c[k],b,1)},n=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),f.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=f.getText(c.childNodes));return b},function(){var a=document.createElement("div"),b="script"+(new Date).getTime();a.innerHTML="<a name='"+b+"'/>";var c=document.documentElement;c.insertBefore(a,c.firstChild),document.getElementById(b)&&(g.find.ID=function(a,b,c){if(typeof b.getElementById!=="undefined"&&!c){var d=b.getElementById(a[1]);return d?d.id===a[1]||typeof d.getAttributeNode!=="undefined"&&d.getAttributeNode("id").nodeValue===a[1]?[d]:undefined:[]}},g.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),c.removeChild(a),c=a=null}(),function(){var a=document.createElement("div");a.appendChild(document.createComment("")),a.getElementsByTagName("*").length>0&&(g.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(g.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),document.querySelectorAll&&function(){var a=f,b=document.createElement("div");b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){f=function(b,c,d,e){c=c||document;if(!e&&c.nodeType===9&&!f.isXML(c))try{return k(c.querySelectorAll(b),d)}catch(g){}return a(b,c,d,e)};for(var c in a)f[c]=a[c];b=null}}(),function(){var a=document.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;g.order.splice(1,0,"CLASS"),g.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),f.contains=document.compareDocumentPosition?function(a,b){return!!(a.compareDocumentPosition(b)&16)}:function(a,b){return a!==b&&(a.contains?a.contains(b):!0)},f.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var q=function(a,b){var c=[],d="",e,h=b.nodeType?[b]:b;while(e=g.match.PSEUDO.exec(a))d+=e[0],a=a.replace(g.match.PSEUDO,"");a=g.relative[a]?a+"*":a;for(var i=0,j=h.length;i<j;i++)f(a,h[i],c);return f.filter(d,c)};window.Sizzle=f}(),RightJS([RightJS.Document,RightJS.Element]).each("include",{first:function(a){return this.find(a)[0]},find:function(a){return RightJS(Sizzle(a,this._)).map(RightJS.$)}})
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/**
|
2
|
-
* RightJS
|
2
|
+
* RightJS-UI Slider v2.2.1
|
3
3
|
* http://rightjs.org/ui/slider
|
4
4
|
*
|
5
|
-
* Copyright (C) 2009-
|
5
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
6
|
*/
|
7
7
|
var Slider = RightJS.Slider = (function(document, Math, RightJS) {
|
8
8
|
/**
|
@@ -10,28 +10,9 @@ var Slider = RightJS.Slider = (function(document, Math, RightJS) {
|
|
10
10
|
* it creates an abstract proxy with the common functionality
|
11
11
|
* which then we reuse and override in the actual widgets
|
12
12
|
*
|
13
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
13
|
+
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
14
14
|
*/
|
15
15
|
|
16
|
-
/**
|
17
|
-
* The filenames to include
|
18
|
-
*
|
19
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
20
|
-
*/
|
21
|
-
var R = RightJS,
|
22
|
-
$ = RightJS.$,
|
23
|
-
$$ = RightJS.$$,
|
24
|
-
$w = RightJS.$w,
|
25
|
-
$E = RightJS.$E,
|
26
|
-
$A = RightJS.$A,
|
27
|
-
isHash = RightJS.isHash,
|
28
|
-
Element = RightJS.Element;
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
16
|
/**
|
36
17
|
* The widget units constructor
|
37
18
|
*
|
@@ -50,7 +31,7 @@ function Widget(tag_name, methods) {
|
|
50
31
|
*
|
51
32
|
* Copyright (C) 2010 Nikolay Nemshilov
|
52
33
|
*/
|
53
|
-
var AbstractWidget = new RightJS.
|
34
|
+
var AbstractWidget = new RightJS.Class(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
|
54
35
|
/**
|
55
36
|
* The common constructor
|
56
37
|
*
|
@@ -82,7 +63,8 @@ function Widget(tag_name, methods) {
|
|
82
63
|
options = {};
|
83
64
|
}
|
84
65
|
this.setOptions(options, this);
|
85
|
-
|
66
|
+
|
67
|
+
return (RightJS.Wrapper.Cache[RightJS.$uid(this._)] = this);
|
86
68
|
},
|
87
69
|
|
88
70
|
// protected
|
@@ -95,12 +77,16 @@ function Widget(tag_name, methods) {
|
|
95
77
|
* @return void
|
96
78
|
*/
|
97
79
|
setOptions: function(options, element) {
|
98
|
-
|
99
|
-
|
100
|
-
RightJS.Object.merge(options, eval("("+(
|
80
|
+
if (element) {
|
81
|
+
options = RightJS.Object.merge(options, new Function("return "+(
|
101
82
|
element.get('data-'+ this.key) || '{}'
|
102
|
-
)
|
103
|
-
|
83
|
+
))());
|
84
|
+
}
|
85
|
+
|
86
|
+
if (options) {
|
87
|
+
RightJS.Options.setOptions.call(this, RightJS.Object.merge(this.options, options));
|
88
|
+
}
|
89
|
+
|
104
90
|
return this;
|
105
91
|
}
|
106
92
|
});
|
@@ -109,7 +95,7 @@ function Widget(tag_name, methods) {
|
|
109
95
|
* Creating the actual widget class
|
110
96
|
*
|
111
97
|
*/
|
112
|
-
var Klass = new RightJS.
|
98
|
+
var Klass = new RightJS.Class(AbstractWidget, methods);
|
113
99
|
|
114
100
|
// creating the widget related shortcuts
|
115
101
|
RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || []);
|
@@ -163,16 +149,35 @@ var Updater = {
|
|
163
149
|
};
|
164
150
|
|
165
151
|
|
152
|
+
/**
|
153
|
+
* The filenames to include
|
154
|
+
*
|
155
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
156
|
+
*/
|
157
|
+
var R = RightJS,
|
158
|
+
$ = RightJS.$,
|
159
|
+
$$ = RightJS.$$,
|
160
|
+
$w = RightJS.$w,
|
161
|
+
$E = RightJS.$E,
|
162
|
+
$A = RightJS.$A,
|
163
|
+
isHash = RightJS.isHash,
|
164
|
+
Element = RightJS.Element;
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
166
171
|
/**
|
167
172
|
* RightJS UI Slider unit
|
168
173
|
*
|
169
|
-
* Copyright (C) 2009-
|
174
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
170
175
|
*/
|
171
176
|
var Slider = new Widget({
|
172
177
|
include: Updater,
|
173
178
|
|
174
179
|
extend: {
|
175
|
-
version: '2.
|
180
|
+
version: '2.2.1',
|
176
181
|
|
177
182
|
EVENTS: $w('change'),
|
178
183
|
|
@@ -373,7 +378,18 @@ $(window).onBlur(function() {
|
|
373
378
|
});
|
374
379
|
|
375
380
|
|
376
|
-
|
381
|
+
var embed_style = document.createElement('style'),
|
382
|
+
embed_rules = document.createTextNode("div.rui-slider,div.rui-slider .handle div.rui-slider .level{margin:0;padding:0;border:none;background:none}div.rui-slider{height:0.4em;width:20em;border:1px solid #bbb;background:#F8F8F8;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;position:relative;margin:.6em 0;display:inline-block; *display:inline; *zoom:1;vertical-align:middle;user-select:none;-moz-user-select:none;-webkit-user-select:none;cursor:pointer}div.rui-slider .handle{font-size:25%;position:absolute;left:0;top:0;width:4pt;height:10pt;margin-top:-4pt;margin-left:0.4em;background:#BBB;border:1px solid #999;border-radius:.8em;-moz-border-radius:.8em;-webkit-border-radius:.8em;z-index:20}div.rui-slider .level{font-size:25%;position:absolute;top:0;left:0;width:0;height:100%;background:#ddd;z-index:1}div.rui-slider-vertical{height:10em;width:0.4em;margin:0 .3em}div.rui-slider-vertical .handle{top:auto;bottom:0;margin:0;margin-left:-4pt;margin-bottom:0.4em;height:5pt;width:10pt}div.rui-slider-vertical .level{height:0;width:100%;top:auto;bottom:0}");
|
383
|
+
|
384
|
+
embed_style.type = 'text/css';
|
385
|
+
document.getElementsByTagName('head')[0].appendChild(embed_style);
|
386
|
+
|
387
|
+
if(embed_style.styleSheet) {
|
388
|
+
embed_style.styleSheet.cssText = embed_rules.nodeValue;
|
389
|
+
} else {
|
390
|
+
embed_style.appendChild(embed_rules);
|
391
|
+
}
|
392
|
+
|
377
393
|
|
378
394
|
return Slider;
|
379
395
|
})(document, Math, RightJS);
|
@@ -1,14 +1,7 @@
|
|
1
1
|
/**
|
2
|
-
* RightJS
|
2
|
+
* RightJS-UI Slider v2.2.1
|
3
3
|
* http://rightjs.org/ui/slider
|
4
4
|
*
|
5
|
-
* Copyright (C) 2009-
|
5
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
6
|
*/
|
7
|
-
var Slider=RightJS.Slider=function(
|
8
|
-
d){d=d||this;e.Options.setOptions.call(this,e.Object.merge(c,eval("("+(d.get("data-"+this.key)||"{}")+")")));return this}});f=new e.Wrapper(f,b);e.Observer.createShortcuts(f.prototype,f.EVENTS||[]);return f})({include:{assignTo:function(a){var b=e(function(c,d){if(c=h(c))c[c.setValue?"setValue":"update"](d.target.getValue())}).curry(a),f=e(function(c,d){(c=h(c))&&c.onChange&&c.onChange(e(function(){this.setValue(c.value())}).bind(d))}).curry(a);if(h(a)){b({target:this});f(this)}else h(j).onReady(e(function(){b({target:this});
|
9
|
-
f(this)}.bind(this)));return this.onChange(b)}},extend:{version:"2.0.0",EVENTS:n("change"),Options:{min:0,max:100,snap:0,value:null,direction:"x",update:null,round:0},current:false},initialize:function(){var a=o(arguments).compact(),b=a.pop();a=a.pop();if(!p(b)||b instanceof q){a=h(a||b);b={}}this.$super("slider",a).setOptions(b).on("selectstart","stopEvent");this.level=this.first(".level")||l("div",{"class":"level"}).insertTo(this);this.handle=this.first(".handle")||l("div",{"class":"handle"}).insertTo(this);
|
10
|
-
b=this.options;this.value=b.value===null?b.min:b.value;b.update&&this.assignTo(b.update);if(b.direction==="y")this.addClass("rui-slider-vertical");else if(this.hasClass("rui-slider-vertical"))b.direction="y";this.setValue(this.value)},setValue:function(a){return this.precalc().shiftTo(a)},getValue:function(){return this.value},insertTo:function(a,b){return this.$super(a,b).setValue(this.value)},precalc:function(){var a=this.options.direction==="x",b=this.handle.setStyle(a?{left:0}:{bottom:0}).dimensions(),
|
11
|
-
f=this.hSize=a?b.width:b.height,c=this.dims=this.dimensions();this.offset=a?b.left-c.left:c.top+c.height-b.top-f;this.space=(a?c.width-f-this.offset*2:c.height-f)-this.offset*2;return this},start:function(a){return this.precalc().e2val(a)},move:function(a){return this.e2val(a)},shiftTo:function(a){var b=this.options,f=k.pow(10,b.round),c=b.direction==="x";a=k.round(a*f)/f;if(a<b.min)a=b.min;if(a>b.max)a=b.max;if(b.snap){f=b.snap;var d=a%f;a=d<f/2?a-d:a-d+f}b=this.space/(b.max-b.min)*(a-b.min);this.handle._.style[c?
|
12
|
-
"left":"bottom"]=b+"px";this.level._.style[c?"width":"height"]=(b>0?b:0)+2+"px";if(a!==this.value){this.value=a;this.fire("change",{value:a})}return this},e2val:function(a){var b=this.options,f=b.direction==="x",c=this.dims,d=this.offset,i=this.space;a=a.position()[f?"x":"y"]-d-this.hSize/2;c=(b.max-b.min)/i*(a-(f?c.left+d:c.top+d));return this.shiftTo(f?b.min+c:b.max-c)}});h(j).on({ready:function(){m(".rui-slider").each(function(a){a instanceof g||new g(a)})},mousedown:function(a){var b=a.find(".rui-slider");
|
13
|
-
if(b){a.stop();b instanceof g||(b=new g(b));g.current=b.start(a)}},mousemove:function(a){g.current&&g.current.move(a)},mouseup:function(){if(g.current)g.current=false}});h(window).onBlur(function(){if(g.current)g.current=false});j.write('<style type="text/css">div.rui-slider,div.rui-slider .handle div.rui-slider .level{margin:0;padding:0;border:none;background:none}div.rui-slider{height:0.4em;width:20em;border:1px solid #bbb;background:#F8F8F8;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;position:relative;margin:.6em 0;display:inline-block; *display:inline; *zoom:1;vertical-align:middle;user-select:none;-moz-user-select:none;-webkit-user-select:none;cursor:pointer}div.rui-slider .handle{font-size:25%;position:absolute;left:0;top:0;width:4pt;height:4em;margin-top:-1.6em;margin-left:0.4em;background:#BBB;border:1px solid #999;border-radius:.8em;-moz-border-radius:.8em;-webkit-border-radius:.8em;z-index:20}div.rui-slider .level{font-size:25%;position:absolute;top:0;left:0;width:0;height:100%;background:#ddd;z-index:1}div.rui-slider-vertical{height:10em;width:0.4em;margin:0 .3em}div.rui-slider-vertical .handle{top:auto;bottom:0;margin:0;margin-left:-1.6em;margin-bottom:0.4em;height:4pt;width:4em}div.rui-slider-vertical .level{height:0;width:100%;top:auto;bottom:0}</style>');
|
14
|
-
return g}(document,Math,RightJS);
|
7
|
+
var Slider=RightJS.Slider=function(a,b,c){function d(a,b){b||(b=a,a="DIV");var d=new c.Class(c.Element.Wrappers[a]||c.Element,{initialize:function(b,d){this.key=b;var e=[{"class":"rui-"+b}];this instanceof c.Input||this instanceof c.Form||e.unshift(a),this.$super.apply(this,e),c.isString(d)&&(d=c.$(d)),d instanceof c.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return c.Wrapper.Cache[c.$uid(this._)]=this},setOptions:function(a,b){b&&(a=c.Object.merge(a,(new Function("return "+(b.get("data-"+this.key)||"{}")))())),a&&c.Options.setOptions.call(this,c.Object.merge(this.options,a));return this}}),e=new c.Class(d,b);c.Observer.createShortcuts(e.prototype,e.EVENTS||[]);return e}var e={assignTo:function(b){var c=f(function(a,b){(a=g(a))&&a[a.setValue?"setValue":"update"](b.target.getValue())}).curry(b),d=f(function(a,b){a=g(a),a&&a.onChange&&a.onChange(f(function(){this.setValue(a.value())}).bind(b))}).curry(b);g(b)?(c({target:this}),d(this)):g(a).onReady(f(function(){c({target:this}),d(this)}.bind(this)));return this.onChange(c)}},f=c,g=c.$,h=c.$$,i=c.$w,j=c.$E,k=c.$A,l=c.isHash,m=c.Element,n=new d({include:e,extend:{version:"2.2.1",EVENTS:i("change"),Options:{min:0,max:100,snap:0,value:null,direction:"x",update:null,round:0},current:!1},initialize:function(){var a=k(arguments).compact(),b=a.pop(),c=a.pop();if(!l(b)||b instanceof m)c=g(c||b),b={};this.$super("slider",c).setOptions(b).on("selectstart","stopEvent"),this.level=this.first(".level")||j("div",{"class":"level"}).insertTo(this),this.handle=this.first(".handle")||j("div",{"class":"handle"}).insertTo(this),b=this.options,this.value=b.value===null?b.min:b.value,b.update&&this.assignTo(b.update),b.direction==="y"?this.addClass("rui-slider-vertical"):this.hasClass("rui-slider-vertical")&&(b.direction="y"),this.setValue(this.value)},setValue:function(a){return this.precalc().shiftTo(a)},getValue:function(){return this.value},insertTo:function(a,b){return this.$super(a,b).setValue(this.value)},precalc:function(){var a=this.options.direction==="x",b=this.handle.setStyle(a?{left:0}:{bottom:0}).dimensions(),c=this.hSize=a?b.width:b.height,d=this.dims=this.dimensions();this.offset=a?b.left-d.left:d.top+d.height-b.top-c,this.space=(a?d.width-c-this.offset*2:d.height-c)-this.offset*2;return this},start:function(a){return this.precalc().e2val(a)},move:function(a){return this.e2val(a)},shiftTo:function(a){var c=this.options,d=b.pow(10,c.round),e=c.direction==="x";a=b.round(a*d)/d,a<c.min&&(a=c.min),a>c.max&&(a=c.max);if(c.snap){var f=c.snap,g=a%f;a=g<f/2?a-g:a-g+f}var h=this.space/(c.max-c.min)*(a-c.min);this.handle._.style[e?"left":"bottom"]=h+"px",this.level._.style[e?"width":"height"]=(h>0?h:0)+2+"px",a!==this.value&&(this.value=a,this.fire("change",{value:a}));return this},e2val:function(a){var b=this.options,c=b.direction==="x",d=this.dims,e=this.offset,f=this.space,g=a.position()[c?"x":"y"]-e-this.hSize/2,h=c?d.left+e:d.top+e,i=(b.max-b.min)/f*(g-h);return this.shiftTo(c?b.min+i:b.max-i)}});g(a).on({ready:function(){h(".rui-slider").each(function(a){a instanceof n||(a=new n(a))})},mousedown:function(a){var b=a.find(".rui-slider");b&&(a.stop(),b instanceof n||(b=new n(b)),n.current=b.start(a))},mousemove:function(a){n.current&&n.current.move(a)},mouseup:function(a){n.current&&(n.current=!1)}}),g(window).onBlur(function(){n.current&&(n.current=!1)});var o=a.createElement("style"),p=a.createTextNode("div.rui-slider,div.rui-slider .handle div.rui-slider .level{margin:0;padding:0;border:none;background:none}div.rui-slider{height:0.4em;width:20em;border:1px solid #bbb;background:#F8F8F8;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;position:relative;margin:.6em 0;display:inline-block; *display:inline; *zoom:1;vertical-align:middle;user-select:none;-moz-user-select:none;-webkit-user-select:none;cursor:pointer}div.rui-slider .handle{font-size:25%;position:absolute;left:0;top:0;width:4pt;height:10pt;margin-top:-4pt;margin-left:0.4em;background:#BBB;border:1px solid #999;border-radius:.8em;-moz-border-radius:.8em;-webkit-border-radius:.8em;z-index:20}div.rui-slider .level{font-size:25%;position:absolute;top:0;left:0;width:0;height:100%;background:#ddd;z-index:1}div.rui-slider-vertical{height:10em;width:0.4em;margin:0 .3em}div.rui-slider-vertical .handle{top:auto;bottom:0;margin:0;margin-left:-4pt;margin-bottom:0.4em;height:5pt;width:10pt}div.rui-slider-vertical .level{height:0;width:100%;top:auto;bottom:0}");o.type="text/css",a.getElementsByTagName("head")[0].appendChild(o),o.styleSheet?o.styleSheet.cssText=p.nodeValue:o.appendChild(p);return n}(document,Math,RightJS)
|
@@ -1,10 +1,8 @@
|
|
1
1
|
/**
|
2
|
-
* Sortable
|
3
|
-
*
|
2
|
+
* RightJS-UI Sortable v2.2.0
|
3
|
+
* http://rightjs.org/ui/sortable
|
4
4
|
*
|
5
|
-
*
|
6
|
-
*
|
7
|
-
* Copyright (C) 2009-2010 Nikolay Nemshilov
|
5
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
8
6
|
*/
|
9
7
|
var Sortable = RightJS.Sortable = (function(document, RightJS) {
|
10
8
|
/**
|
@@ -12,24 +10,9 @@ var Sortable = RightJS.Sortable = (function(document, RightJS) {
|
|
12
10
|
* it creates an abstract proxy with the common functionality
|
13
11
|
* which then we reuse and override in the actual widgets
|
14
12
|
*
|
15
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
13
|
+
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
16
14
|
*/
|
17
15
|
|
18
|
-
/**
|
19
|
-
* Sortable initialization script
|
20
|
-
*
|
21
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
22
|
-
*/
|
23
|
-
var R = RightJS,
|
24
|
-
$ = RightJS.$,
|
25
|
-
$w = RightJS.$w,
|
26
|
-
isString = RightJS.isString,
|
27
|
-
isArray = RightJS.isArray,
|
28
|
-
Object = RightJS.Object;
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
16
|
/**
|
34
17
|
* The widget units constructor
|
35
18
|
*
|
@@ -48,7 +31,7 @@ function Widget(tag_name, methods) {
|
|
48
31
|
*
|
49
32
|
* Copyright (C) 2010 Nikolay Nemshilov
|
50
33
|
*/
|
51
|
-
var AbstractWidget = new RightJS.
|
34
|
+
var AbstractWidget = new RightJS.Class(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
|
52
35
|
/**
|
53
36
|
* The common constructor
|
54
37
|
*
|
@@ -80,7 +63,8 @@ function Widget(tag_name, methods) {
|
|
80
63
|
options = {};
|
81
64
|
}
|
82
65
|
this.setOptions(options, this);
|
83
|
-
|
66
|
+
|
67
|
+
return (RightJS.Wrapper.Cache[RightJS.$uid(this._)] = this);
|
84
68
|
},
|
85
69
|
|
86
70
|
// protected
|
@@ -93,12 +77,16 @@ function Widget(tag_name, methods) {
|
|
93
77
|
* @return void
|
94
78
|
*/
|
95
79
|
setOptions: function(options, element) {
|
96
|
-
|
97
|
-
|
98
|
-
RightJS.Object.merge(options, eval("("+(
|
80
|
+
if (element) {
|
81
|
+
options = RightJS.Object.merge(options, new Function("return "+(
|
99
82
|
element.get('data-'+ this.key) || '{}'
|
100
|
-
)
|
101
|
-
|
83
|
+
))());
|
84
|
+
}
|
85
|
+
|
86
|
+
if (options) {
|
87
|
+
RightJS.Options.setOptions.call(this, RightJS.Object.merge(this.options, options));
|
88
|
+
}
|
89
|
+
|
102
90
|
return this;
|
103
91
|
}
|
104
92
|
});
|
@@ -107,7 +95,7 @@ function Widget(tag_name, methods) {
|
|
107
95
|
* Creating the actual widget class
|
108
96
|
*
|
109
97
|
*/
|
110
|
-
var Klass = new RightJS.
|
98
|
+
var Klass = new RightJS.Class(AbstractWidget, methods);
|
111
99
|
|
112
100
|
// creating the widget related shortcuts
|
113
101
|
RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || []);
|
@@ -116,14 +104,29 @@ function Widget(tag_name, methods) {
|
|
116
104
|
}
|
117
105
|
|
118
106
|
|
107
|
+
/**
|
108
|
+
* Sortable initialization script
|
109
|
+
*
|
110
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
111
|
+
*/
|
112
|
+
var R = RightJS,
|
113
|
+
$ = RightJS.$,
|
114
|
+
$w = RightJS.$w,
|
115
|
+
isString = RightJS.isString,
|
116
|
+
isArray = RightJS.isArray,
|
117
|
+
Object = RightJS.Object;
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
119
122
|
/**
|
120
123
|
* The Sortable unit
|
121
124
|
*
|
122
|
-
* Copyright (C) 2009-
|
125
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
123
126
|
*/
|
124
127
|
var Sortable = new Widget('UL', {
|
125
128
|
extend: {
|
126
|
-
version: '2.
|
129
|
+
version: '2.2.0',
|
127
130
|
|
128
131
|
EVENTS: $w('start change finish'),
|
129
132
|
|
@@ -410,7 +413,18 @@ $(window).onBlur(function() {
|
|
410
413
|
});
|
411
414
|
|
412
415
|
|
413
|
-
document.
|
416
|
+
var embed_style = document.createElement('style'),
|
417
|
+
embed_rules = document.createTextNode(".rui-sortable{user-select:none;-moz-user-select:none;-webkit-user-select:none}");
|
418
|
+
|
419
|
+
embed_style.type = 'text/css';
|
420
|
+
document.getElementsByTagName('head')[0].appendChild(embed_style);
|
421
|
+
|
422
|
+
if(embed_style.styleSheet) {
|
423
|
+
embed_style.styleSheet.cssText = embed_rules.nodeValue;
|
424
|
+
} else {
|
425
|
+
embed_style.appendChild(embed_rules);
|
426
|
+
}
|
427
|
+
|
414
428
|
|
415
429
|
return Sortable;
|
416
430
|
})(document, RightJS);
|
@@ -1,16 +1,7 @@
|
|
1
1
|
/**
|
2
|
-
* Sortable
|
3
|
-
*
|
2
|
+
* RightJS-UI Sortable v2.2.0
|
3
|
+
* http://rightjs.org/ui/sortable
|
4
4
|
*
|
5
|
-
*
|
6
|
-
*
|
7
|
-
* Copyright (C) 2009-2010 Nikolay Nemshilov
|
5
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
8
6
|
*/
|
9
|
-
var Sortable=RightJS.Sortable=function(
|
10
|
-
d){d=d||this;f.Options.setOptions.call(this,f.Object.merge(e,eval("("+(d.get("data-"+this.key)||"{}")+")")));return this}});c=new f.Wrapper(c,b);f.Observer.createShortcuts(c.prototype,c.EVENTS||[]);return c})("UL",{extend:{version:"2.0.0",EVENTS:n("start change finish"),Options:{url:null,method:"put",Xhr:{},idParam:"id",posParam:"position",parseId:true,dragClass:"dragging",accept:null,minLength:1,itemCss:"li",handleCss:"li",cssRule:"*[data-sortable]"},current:false,cast:function(a){a=j(a._);a instanceof
|
11
|
-
h||(a=new h(a));return a}},initialize:function(a,b){this.$super("sortable",a).setOptions(b).addClass("rui-sortable").on("finish",this._tryXhr).on("selectstart","stopEvent")},setOptions:function(a,b){this.$super(a,b);a=this.options;var c=a.accept||[];p(c)||(c=[c]);a.accept=f([this].concat(c)).map(j).uniq();return this},items:function(){return this.children(this.options.itemCss)},startDrag:function(a){if(!(this.items().length<=this.options.minLength)){var b=a.find(this.options.itemCss),c=a.find(this.options.handleCss);
|
12
|
-
if(b&&c){this._initDrag(b,a.position());h.current=this;this.fire("start",this._evOpts(a))}}},moveItem:function(a){var b=a.position(),c=this.itemClone._.style,e=b.y-this.yRDiff,d=b.x-this.xRDiff,g=d+this.cloneWidth,m=e+this.cloneHeight;c.top=b.y-this.yDiff+"px";c.left=b.x-this.xDiff+"px";if(b=this.suspects.first(function(i){return(e>i.top&&e<i.topHalf||m<i.bottom&&m>i.topHalf)&&(d>i.left&&d<i.leftHalf||g<i.right&&g>i.leftHalf)})){c=b.item;c.insert(this.item,c.prevSiblings().include(this.item)?"after":
|
13
|
-
"before");this._findSuspects();this.fire("change",this._evOpts(a,c))}},finishDrag:function(a){if(this.itemClone){this.itemClone.remove();this.item.setStyle("visibility:visible")}h.current=false;this.fire("finish",this._evOpts(a))},_evOpts:function(a,b){b=b||this.item;var c=h.cast(b.parent());return{list:c,item:b,event:a,index:c.items().indexOf(b)}},_initDrag:function(a,b){this.dimensions();var c=a.dimensions(),e=a.clone().setStyle({margin:0,zIndex:9999,position:"absolute",top:"0px",left:"0px"}).addClass(this.options.dragClass).insertTo(this).setHeight(this.cloneHeight=
|
14
|
-
c.height).setWidth(this.cloneWidth=c.width),d=e.position(),g=c.left-d.x;c=c.top-d.y;e.moveTo(g,c);this.item=a.setStyle("visibility:hidden");this.itemClone=e;this.xDiff=b.x-g;this.yDiff=b.y-c;this.xRDiff=b.x-e.position().x;this.yRDiff=b.y-e.position().y;this._findSuspects()},_findSuspects:function(){var a=this.suspects=f([]),b=this.item,c=this.itemClone;this.options.accept.each(function(e){h.cast(e).items().each(function(d){if(d!==b&&d!==c){var g=d.dimensions();a.push({item:d,top:g.top,left:g.left,
|
15
|
-
right:g.left+g.width,bottom:g.top+g.height,topHalf:g.top+g.height/2,leftHalf:g.left+g.width/2})}})})},_tryXhr:function(a){if(this.options.url){var b=f(this.options.url),c={},e=a.item;a=a.index+1;var d=k.merge({method:this.options.method,params:{}},this.options.Xhr);e=e.get("id")||"";if(this.options.parseId&&e)e=(e.match(/\d+/)||[""])[0];if(b.include("%{id}"))b=b.replace("%{id}",e);else c[this.options.idParam]=e;c[this.options.posParam]=a;if(o(d.params))d.params+="&"+k.toQueryString(c);else d.params=
|
16
|
-
k.merge(d.params,c);f.Xhr.load(b,d)}}});j(l).on({mousedown:function(a){var b=a.find(h.Options.cssRule+",*.rui-sortable");b&&h.cast(b).startDrag(a)},mousemove:function(a){h.current&&h.current.moveItem(a)},mouseup:function(a){h.current&&h.current.finishDrag(a)}});j(window).onBlur(function(){h.current&&h.current.finishDrag()});l.write('<style type="text/css">.rui-sortable{user-select:none;-moz-user-select:none;-webkit-user-select:none}</style>');return h}(document,RightJS);
|
7
|
+
var Sortable=RightJS.Sortable=function(a,b){function c(a,c){c||(c=a,a="DIV");var d=new b.Class(b.Element.Wrappers[a]||b.Element,{initialize:function(c,d){this.key=c;var e=[{"class":"rui-"+c}];this instanceof b.Input||this instanceof b.Form||e.unshift(a),this.$super.apply(this,e),b.isString(d)&&(d=b.$(d)),d instanceof b.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return b.Wrapper.Cache[b.$uid(this._)]=this},setOptions:function(a,c){c&&(a=b.Object.merge(a,(new Function("return "+(c.get("data-"+this.key)||"{}")))())),a&&b.Options.setOptions.call(this,b.Object.merge(this.options,a));return this}}),e=new b.Class(d,c);b.Observer.createShortcuts(e.prototype,e.EVENTS||[]);return e}var d=b,e=b.$,f=b.$w,g=b.isString,h=b.isArray,i=b.Object,j=new c("UL",{extend:{version:"2.2.0",EVENTS:f("start change finish"),Options:{url:null,method:"put",Xhr:{},idParam:"id",posParam:"position",parseId:!0,dragClass:"dragging",accept:null,minLength:1,itemCss:"li",handleCss:"li",cssRule:"*[data-sortable]"},current:!1,cast:function(a){a=e(a._),a instanceof j||(a=new j(a));return a}},initialize:function(a,b){this.$super("sortable",a).setOptions(b).addClass("rui-sortable").on("finish",this._tryXhr).on("selectstart","stopEvent")},setOptions:function(a,b){this.$super(a,b),a=this.options;var c=a.accept||[];h(c)||(c=[c]),a.accept=d([this].concat(c)).map(e).uniq();return this},items:function(){return this.children(this.options.itemCss)},startDrag:function(a){if(this.items().length>this.options.minLength){var b=a.find(this.options.itemCss),c=a.find(this.options.handleCss);b&&c&&(this._initDrag(b,a.position()),j.current=this,this.fire("start",this._evOpts(a)))}},moveItem:function(a){var b=a.position(),c=this.itemClone._.style,d=b.y-this.yRDiff,e=b.x-this.xRDiff,f=e+this.cloneWidth,g=d+this.cloneHeight;c.top=b.y-this.yDiff+"px",c.left=b.x-this.xDiff+"px";var h=this.suspects.first(function(a){return(d>a.top&&d<a.topHalf||g<a.bottom&&g>a.topHalf)&&(e>a.left&&e<a.leftHalf||f<a.right&&f>a.leftHalf)});h&&(c=h.item,c.insert(this.item,c.prevSiblings().include(this.item)?"after":"before"),this._findSuspects(),this.fire("change",this._evOpts(a,c)))},finishDrag:function(a){this.itemClone&&(this.itemClone.remove(),this.item.setStyle("visibility:visible")),j.current=!1,this.fire("finish",this._evOpts(a))},_evOpts:function(a,b){b=b||this.item;var c=j.cast(b.parent());return{list:c,item:b,event:a,index:c.items().indexOf(b)}},_initDrag:function(a,b){var c=this.dimensions(),d=a.dimensions(),e=a.clone().setStyle({margin:0,zIndex:9999,position:"absolute",top:"0px",left:"0px"}).addClass(this.options.dragClass).insertTo(this).setHeight(this.cloneHeight=d.height).setWidth(this.cloneWidth=d.width),f=e.position(),g=d.left-f.x,h=d.top-f.y;e.moveTo(g,h),this.item=a.setStyle("visibility:hidden"),this.itemClone=e,this.xDiff=b.x-g,this.yDiff=b.y-h,this.xRDiff=b.x-e.position().x,this.yRDiff=b.y-e.position().y,this._findSuspects()},_findSuspects:function(){var a=this.suspects=d([]),b=this.item,c=this.itemClone;this.options.accept.each(function(d){j.cast(d).items().each(function(d){if(d!==b&&d!==c){var e=d.dimensions();a.push({item:d,top:e.top,left:e.left,right:e.left+e.width,bottom:e.top+e.height,topHalf:e.top+e.height/2,leftHalf:e.left+e.width/2})}})})},_tryXhr:function(a){if(this.options.url){var c=d(this.options.url),e={},f=a.item,h=a.index+1,j=i.merge({method:this.options.method,params:{}},this.options.Xhr),k=f.get("id")||"";this.options.parseId&&k&&(k=(k.match(/\d+/)||[""])[0]),c.include("%{id}")?c=c.replace("%{id}",k):e[this.options.idParam]=k,e[this.options.posParam]=h,g(j.params)?j.params+="&"+i.toQueryString(e):j.params=i.merge(j.params,e),b.Xhr.load(c,j)}}});e(a).on({mousedown:function(a){var b=a.find(j.Options.cssRule+",*.rui-sortable");b&&j.cast(b).startDrag(a)},mousemove:function(a){j.current&&j.current.moveItem(a)},mouseup:function(a){j.current&&j.current.finishDrag(a)}}),e(window).onBlur(function(){j.current&&j.current.finishDrag()});var k=a.createElement("style"),l=a.createTextNode(".rui-sortable{user-select:none;-moz-user-select:none;-webkit-user-select:none}");k.type="text/css",a.getElementsByTagName("head")[0].appendChild(k),k.styleSheet?k.styleSheet.cssText=l.nodeValue:k.appendChild(l);return j}(document,RightJS)
|
@@ -1,15 +1,10 @@
|
|
1
1
|
/**
|
2
|
-
* Tables
|
2
|
+
* Tables Specific Wrappers v2.2.0
|
3
|
+
* http://rightjs.org/plugins/table
|
3
4
|
*
|
4
|
-
* Copyright (C)
|
5
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
5
6
|
*/
|
6
7
|
var Table = RightJS.Table = (function(RightJS) {
|
7
|
-
/**
|
8
|
-
* Tables specific dom-wrapper
|
9
|
-
*
|
10
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
11
|
-
*/
|
12
|
-
|
13
8
|
/**
|
14
9
|
* Table plugin initialization script
|
15
10
|
*
|
@@ -26,14 +21,23 @@ var R = RightJS,
|
|
26
21
|
|
27
22
|
|
28
23
|
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Tables specific dom-wrapper
|
27
|
+
*
|
28
|
+
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
29
|
+
*/
|
29
30
|
var Table = Element.Wrappers.TABLE = new Class(Element, {
|
30
31
|
|
31
32
|
extend: {
|
33
|
+
version: '2.2.0',
|
34
|
+
|
32
35
|
Options: {
|
33
36
|
ascMarker: '▼', // asc marker content
|
34
37
|
descMarker: '▲', // desc marker content
|
35
38
|
algorithm: 'text', // default sorting algorithm 'text' or 'numeric'
|
36
|
-
order: 'asc' // default order
|
39
|
+
order: 'asc', // default order
|
40
|
+
sortedClass: 'sorted'
|
37
41
|
}
|
38
42
|
},
|
39
43
|
|
@@ -53,7 +57,7 @@ var Table = Element.Wrappers.TABLE = new Class(Element, {
|
|
53
57
|
this.$super(element, options);
|
54
58
|
|
55
59
|
this.options = Object.merge(
|
56
|
-
Table.Options,
|
60
|
+
Table.Options, new Function('return '+ this.get('data-table'))
|
57
61
|
);
|
58
62
|
},
|
59
63
|
|
@@ -77,6 +81,7 @@ var Table = Element.Wrappers.TABLE = new Class(Element, {
|
|
77
81
|
// handling the fallback from the options
|
78
82
|
direction = direction || this.options.order;
|
79
83
|
algorithm = algorithm || this.options.algorithm;
|
84
|
+
sortedClass = this.options.sortedClass;
|
80
85
|
|
81
86
|
// collecting the list of sortable rows
|
82
87
|
var rows = this.rows().map(function(row) {
|
@@ -117,6 +122,10 @@ var Table = Element.Wrappers.TABLE = new Class(Element, {
|
|
117
122
|
this.options[direction === 'asc' ? 'ascMarker' : 'descMarker']
|
118
123
|
).insertTo(th, 'bottom');
|
119
124
|
this.marker.asc = direction === 'asc';
|
125
|
+
this.find('th').each(function(th) {
|
126
|
+
th.removeClass(sortedClass);
|
127
|
+
});
|
128
|
+
this.marker.parent().toggleClass(sortedClass);
|
120
129
|
|
121
130
|
return this;
|
122
131
|
},
|
@@ -1,9 +1,7 @@
|
|
1
1
|
/**
|
2
|
-
* Tables
|
2
|
+
* Tables Specific Wrappers v2.2.0
|
3
|
+
* http://rightjs.org/plugins/table
|
3
4
|
*
|
4
|
-
* Copyright (C)
|
5
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
5
6
|
*/
|
6
|
-
var Table=RightJS.Table=function(
|
7
|
-
c=c||(this.marker&&this.marker.parent()===g?this.marker.asc?"desc":"asc":null);f=f||(g.hasClass("numeric")?"numeric":null);c=c||this.options.order;f=f||this.options.algorithm;var j=this.rows().map(function(d){var b=d.children("td")[a];b=b?b.text():"";if(f==="numeric")b=e(b).toFloat();return{row:d,text:b}}),l=j[0]?h("tr").insertTo(j[0].row,"before"):h("tr").insertTo(this.first("tbody")||this);if(typeof f!=="function")f=c==="asc"?function(d,b){return d.text>b.text?1:d.text<b.text?-1:0}:function(d,b){return d.text>
|
8
|
-
b.text?-1:d.text<b.text?1:0};j.sort(f).reverse().each(function(d){l.insert(d.row,"after")});l.remove();this.marker=(this.marker||g.first("span.sort-marker")||h("span",{"class":"sort-marker"})).update(this.options[c==="asc"?"ascMarker":"descMarker"]).insertTo(g,"bottom");this.marker.asc=c==="asc";return this},rows:function(){return this.find("tr").reject(function(a){return a.first("th")||a.parent("tfoot")})},header:function(){return this.find("tr").filter("first","th")},footer:function(){return this.find("tfoot > tr")}});
|
9
|
-
m(document).onClick(function(a){(a=a.find("th.sortable"))&&a.parent("table").sort(a)});return k}(RightJS);
|
7
|
+
var Table=RightJS.Table=function(a){var b=a,c=a.$,d=a.$E,e=a.isHash,f=a.isElement,g=a.Class,h=a.Object,i=a.Element,j=i.Wrappers.TABLE=new g(i,{extend:{version:"2.2.0",Options:{ascMarker:"▼",descMarker:"▲",algorithm:"text",order:"asc",sortedClass:"sorted"}},initialize:function(a){var b=a||{},c=b;e(b)&&!f(b)&&(c="table"),this.$super(c,b),this.options=h.merge(j.Options,new Function("return "+this.get("data-table")))},sort:function(a,c,e){var f=a instanceof i?a:this.header().last().children("th")[a];if(!f)return this;a=f.parent().children("th").indexOf(f),c=c||(this.marker&&this.marker.parent()===f?this.marker.asc?"desc":"asc":null),e=e||(f.hasClass("numeric")?"numeric":null),c=c||this.options.order,e=e||this.options.algorithm,sortedClass=this.options.sortedClass;var g=this.rows().map(function(c){var d=c.children("td")[a],f=d?d.text():"";e==="numeric"&&(f=b(f).toFloat());return{row:c,text:f}}),h=g[0]?d("tr").insertTo(g[0].row,"before"):d("tr").insertTo(this.first("tbody")||this);typeof e!=="function"&&(e=c==="asc"?function(a,b){return a.text>b.text?1:a.text<b.text?-1:0}:function(a,b){return a.text>b.text?-1:a.text<b.text?1:0}),g.sort(e).reverse().each(function(a){h.insert(a.row,"after")}),h.remove(),this.marker=(this.marker||f.first("span.sort-marker")||d("span",{"class":"sort-marker"})).update(this.options[c==="asc"?"ascMarker":"descMarker"]).insertTo(f,"bottom"),this.marker.asc=c==="asc",this.find("th").each(function(a){a.removeClass(sortedClass)}),this.marker.parent().toggleClass(sortedClass);return this},rows:function(){return this.find("tr").reject(function(a){return a.first("th")||a.parent("tfoot")})},header:function(){return this.find("tr").filter("first","th")},footer:function(){return this.find("tfoot > tr")}});c(document).onClick(function(a){var b=a.find("th.sortable");b&&b.parent("table").sort(b)});return j}(RightJS)
|