right-rails 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/init.rb +1 -0
- data/lib/generators/right_rails/right_rails_generator.rb +15 -6
- data/lib/right_rails.rb +1 -1
- data/lib/right_rails/controller_extensions.rb +28 -15
- data/lib/right_rails/helpers/misc.rb +38 -38
- data/lib/right_rails/helpers/rails.rb +50 -7
- data/lib/rjs_renderer.rb +26 -0
- data/spec/lib/right_rails/controller_extensions_spec.rb +25 -14
- data/spec/lib/right_rails/helpers/forms_spec.rb +6 -6
- data/spec/lib/right_rails/helpers/rails_spec.rb +44 -45
- data/vendor/assets/images/rightjs-ui/rte.png +0 -0
- data/vendor/assets/javascripts/right-safe-src.js +2 -2
- data/vendor/assets/javascripts/right-safe.js +2 -2
- data/vendor/assets/javascripts/right-src.js +386 -100
- data/vendor/assets/javascripts/right.js +2 -2
- data/vendor/assets/javascripts/right/calendar-src.js +19 -3
- data/vendor/assets/javascripts/right/calendar.js +2 -2
- data/vendor/assets/javascripts/right/colorpicker-src.js +59 -20
- data/vendor/assets/javascripts/right/colorpicker.js +2 -2
- data/vendor/assets/javascripts/right/i18n/de.js +43 -42
- data/vendor/assets/javascripts/right/i18n/es.js +1 -0
- data/vendor/assets/javascripts/right/i18n/fi.js +1 -0
- data/vendor/assets/javascripts/right/i18n/fr.js +1 -0
- data/vendor/assets/javascripts/right/i18n/hu.js +1 -0
- data/vendor/assets/javascripts/right/i18n/it.js +1 -0
- data/vendor/assets/javascripts/right/i18n/jp.js +1 -0
- data/vendor/assets/javascripts/right/i18n/lt.js +96 -0
- data/vendor/assets/javascripts/right/i18n/nl.js +1 -0
- data/vendor/assets/javascripts/right/i18n/pt-br.js +1 -0
- data/vendor/assets/javascripts/right/i18n/ru.js +1 -0
- data/vendor/assets/javascripts/right/i18n/ua.js +1 -0
- data/vendor/assets/javascripts/right/jquerysh-src.js +4 -4
- data/vendor/assets/javascripts/right/jquerysh.js +2 -2
- data/vendor/assets/javascripts/right/rails-src.js +51 -15
- data/vendor/assets/javascripts/right/rails.js +2 -2
- data/vendor/assets/javascripts/right/resizable-src.js +11 -11
- data/vendor/assets/javascripts/right/rte-src.js +33 -13
- data/vendor/assets/javascripts/right/rte.js +2 -2
- data/vendor/assets/javascripts/right/slider-src.js +137 -28
- data/vendor/assets/javascripts/right/slider.js +2 -2
- metadata +24 -126
- data/generators/right_rails/right_rails_generator.rb +0 -46
- data/generators/right_rails/templates/iframed.html.erb +0 -10
- data/generators/right_scaffold/right_scaffold_generator.rb +0 -53
- data/generators/right_scaffold/templates/controller.rb +0 -99
- data/generators/right_scaffold/templates/helper.rb +0 -2
- data/generators/right_scaffold/templates/layout.html.erb +0 -18
- data/generators/right_scaffold/templates/style.css +0 -54
- data/generators/right_scaffold/templates/view__form.html.erb +0 -16
- data/generators/right_scaffold/templates/view__item.html.erb +0 -13
- data/generators/right_scaffold/templates/view_edit.html.erb +0 -6
- data/generators/right_scaffold/templates/view_index.html.erb +0 -9
- data/generators/right_scaffold/templates/view_new.html.erb +0 -5
- data/generators/right_scaffold/templates/view_show.html.erb +0 -10
- data/lib/generators/right_rails/templates/iframed.html.erb +0 -10
- data/public/images/rightjs-ui/colorpicker.png +0 -0
- data/public/images/rightjs-ui/resizable.png +0 -0
- data/public/images/rightjs-ui/rte.png +0 -0
- data/public/javascripts/right-olds-src.js +0 -652
- data/public/javascripts/right-olds.js +0 -9
- data/public/javascripts/right-safe-src.js +0 -68
- data/public/javascripts/right-safe.js +0 -7
- data/public/javascripts/right-src.js +0 -6014
- data/public/javascripts/right.js +0 -7
- data/public/javascripts/right/autocompleter-src.js +0 -625
- data/public/javascripts/right/autocompleter.js +0 -7
- data/public/javascripts/right/billboard-src.js +0 -564
- data/public/javascripts/right/billboard.js +0 -7
- data/public/javascripts/right/calendar-src.js +0 -1464
- data/public/javascripts/right/calendar.js +0 -7
- data/public/javascripts/right/casting-src.js +0 -183
- data/public/javascripts/right/casting.js +0 -7
- data/public/javascripts/right/colorpicker-src.js +0 -981
- data/public/javascripts/right/colorpicker.js +0 -7
- data/public/javascripts/right/dialog-src.js +0 -768
- data/public/javascripts/right/dialog.js +0 -7
- data/public/javascripts/right/dnd-src.js +0 -591
- data/public/javascripts/right/dnd.js +0 -7
- data/public/javascripts/right/effects-src.js +0 -508
- data/public/javascripts/right/effects.js +0 -7
- data/public/javascripts/right/i18n/de.js +0 -95
- data/public/javascripts/right/i18n/en-us.js +0 -11
- data/public/javascripts/right/i18n/es.js +0 -95
- data/public/javascripts/right/i18n/fi.js +0 -96
- data/public/javascripts/right/i18n/fr.js +0 -95
- data/public/javascripts/right/i18n/hu.js +0 -100
- data/public/javascripts/right/i18n/it.js +0 -95
- data/public/javascripts/right/i18n/jp.js +0 -99
- data/public/javascripts/right/i18n/nl.js +0 -95
- data/public/javascripts/right/i18n/pt-br.js +0 -95
- data/public/javascripts/right/i18n/ru.js +0 -95
- data/public/javascripts/right/i18n/ua.js +0 -99
- data/public/javascripts/right/in-edit-src.js +0 -373
- data/public/javascripts/right/in-edit.js +0 -7
- data/public/javascripts/right/jquerysh-src.js +0 -362
- data/public/javascripts/right/jquerysh.js +0 -7
- data/public/javascripts/right/json-src.js +0 -147
- data/public/javascripts/right/json.js +0 -7
- data/public/javascripts/right/keys-src.js +0 -87
- data/public/javascripts/right/keys.js +0 -7
- data/public/javascripts/right/lightbox-src.js +0 -931
- data/public/javascripts/right/lightbox.js +0 -7
- data/public/javascripts/right/rails-src.js +0 -402
- data/public/javascripts/right/rails.js +0 -7
- data/public/javascripts/right/rater-src.js +0 -384
- data/public/javascripts/right/rater.js +0 -7
- data/public/javascripts/right/resizable-src.js +0 -465
- data/public/javascripts/right/resizable.js +0 -7
- data/public/javascripts/right/rte-src.js +0 -2685
- data/public/javascripts/right/rte.js +0 -7
- data/public/javascripts/right/selectable-src.js +0 -725
- data/public/javascripts/right/selectable.js +0 -7
- data/public/javascripts/right/sizzle-src.js +0 -1132
- data/public/javascripts/right/sizzle.js +0 -7
- data/public/javascripts/right/slider-src.js +0 -395
- data/public/javascripts/right/slider.js +0 -7
- data/public/javascripts/right/sortable-src.js +0 -430
- data/public/javascripts/right/sortable.js +0 -7
- data/public/javascripts/right/table-src.js +0 -176
- data/public/javascripts/right/table.js +0 -7
- data/public/javascripts/right/tabs-src.js +0 -1157
- data/public/javascripts/right/tabs.js +0 -7
- data/public/javascripts/right/tags-src.js +0 -745
- data/public/javascripts/right/tags.js +0 -7
- data/public/javascripts/right/tooltips-src.js +0 -331
- data/public/javascripts/right/tooltips.js +0 -7
- data/public/javascripts/right/uploader-src.js +0 -302
- data/public/javascripts/right/uploader.js +0 -7
@@ -1,7 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Sizzle Engine Support v2.2.0
|
3
|
-
* http://rightjs.org/plugins/sizzle
|
4
|
-
*
|
5
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
|
-
*/
|
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,395 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* RightJS-UI Slider v2.2.3
|
3
|
-
* http://rightjs.org/ui/slider
|
4
|
-
*
|
5
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
|
-
*/
|
7
|
-
var Slider = RightJS.Slider = (function(document, Math, RightJS) {
|
8
|
-
/**
|
9
|
-
* This module defines the basic widgets constructor
|
10
|
-
* it creates an abstract proxy with the common functionality
|
11
|
-
* which then we reuse and override in the actual widgets
|
12
|
-
*
|
13
|
-
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
14
|
-
*/
|
15
|
-
|
16
|
-
/**
|
17
|
-
* The widget units constructor
|
18
|
-
*
|
19
|
-
* @param String tag-name or Object methods
|
20
|
-
* @param Object methods
|
21
|
-
* @return Widget wrapper
|
22
|
-
*/
|
23
|
-
function Widget(tag_name, methods) {
|
24
|
-
if (!methods) {
|
25
|
-
methods = tag_name;
|
26
|
-
tag_name = 'DIV';
|
27
|
-
}
|
28
|
-
|
29
|
-
/**
|
30
|
-
* An Abstract Widget Unit
|
31
|
-
*
|
32
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
33
|
-
*/
|
34
|
-
var AbstractWidget = new RightJS.Class(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
|
35
|
-
/**
|
36
|
-
* The common constructor
|
37
|
-
*
|
38
|
-
* @param Object options
|
39
|
-
* @param String optional tag name
|
40
|
-
* @return void
|
41
|
-
*/
|
42
|
-
initialize: function(key, options) {
|
43
|
-
this.key = key;
|
44
|
-
var args = [{'class': 'rui-' + key}];
|
45
|
-
|
46
|
-
// those two have different constructors
|
47
|
-
if (!(this instanceof RightJS.Input || this instanceof RightJS.Form)) {
|
48
|
-
args.unshift(tag_name);
|
49
|
-
}
|
50
|
-
this.$super.apply(this, args);
|
51
|
-
|
52
|
-
if (RightJS.isString(options)) {
|
53
|
-
options = RightJS.$(options);
|
54
|
-
}
|
55
|
-
|
56
|
-
// if the options is another element then
|
57
|
-
// try to dynamically rewrap it with our widget
|
58
|
-
if (options instanceof RightJS.Element) {
|
59
|
-
this._ = options._;
|
60
|
-
if ('$listeners' in options) {
|
61
|
-
options.$listeners = options.$listeners;
|
62
|
-
}
|
63
|
-
options = {};
|
64
|
-
}
|
65
|
-
this.setOptions(options, this);
|
66
|
-
|
67
|
-
return (RightJS.Wrapper.Cache[RightJS.$uid(this._)] = this);
|
68
|
-
},
|
69
|
-
|
70
|
-
// protected
|
71
|
-
|
72
|
-
/**
|
73
|
-
* Catches the options
|
74
|
-
*
|
75
|
-
* @param Object user-options
|
76
|
-
* @param Element element with contextual options
|
77
|
-
* @return void
|
78
|
-
*/
|
79
|
-
setOptions: function(options, element) {
|
80
|
-
if (element) {
|
81
|
-
options = RightJS.Object.merge(options, new Function("return "+(
|
82
|
-
element.get('data-'+ this.key) || '{}'
|
83
|
-
))());
|
84
|
-
}
|
85
|
-
|
86
|
-
if (options) {
|
87
|
-
RightJS.Options.setOptions.call(this, RightJS.Object.merge(this.options, options));
|
88
|
-
}
|
89
|
-
|
90
|
-
return this;
|
91
|
-
}
|
92
|
-
});
|
93
|
-
|
94
|
-
/**
|
95
|
-
* Creating the actual widget class
|
96
|
-
*
|
97
|
-
*/
|
98
|
-
var Klass = new RightJS.Class(AbstractWidget, methods);
|
99
|
-
|
100
|
-
// creating the widget related shortcuts
|
101
|
-
RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || RightJS([]));
|
102
|
-
|
103
|
-
return Klass;
|
104
|
-
}
|
105
|
-
|
106
|
-
|
107
|
-
/**
|
108
|
-
* Same as the assignable, only it doesn't work with popups
|
109
|
-
* instead it simply updates the assigned unit value/content
|
110
|
-
*
|
111
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
112
|
-
*/
|
113
|
-
var Updater = {
|
114
|
-
|
115
|
-
/**
|
116
|
-
* Assigns the unit to work with an input element
|
117
|
-
*
|
118
|
-
* @param mixed element reference
|
119
|
-
* @return Rater this
|
120
|
-
*/
|
121
|
-
assignTo: function(element) {
|
122
|
-
var assign = R(function(element, event) {
|
123
|
-
if ((element = $(element))) {
|
124
|
-
element[element.setValue ? 'setValue' : 'update'](event.target.getValue());
|
125
|
-
}
|
126
|
-
}).curry(element);
|
127
|
-
|
128
|
-
var connect = R(function(element, object) {
|
129
|
-
element = $(element);
|
130
|
-
if (element && element.onChange) {
|
131
|
-
element.onChange(R(function() {
|
132
|
-
this.setValue(element.value());
|
133
|
-
}).bind(object));
|
134
|
-
}
|
135
|
-
}).curry(element);
|
136
|
-
|
137
|
-
if ($(element)) {
|
138
|
-
assign({target: this});
|
139
|
-
connect(this);
|
140
|
-
} else {
|
141
|
-
$(document).onReady(R(function() {
|
142
|
-
assign({target: this});
|
143
|
-
connect(this);
|
144
|
-
}.bind(this)));
|
145
|
-
}
|
146
|
-
|
147
|
-
return this.onChange(assign);
|
148
|
-
}
|
149
|
-
};
|
150
|
-
|
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
|
-
|
171
|
-
/**
|
172
|
-
* RightJS UI Slider unit
|
173
|
-
*
|
174
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
175
|
-
*/
|
176
|
-
var Slider = new Widget({
|
177
|
-
include: Updater,
|
178
|
-
|
179
|
-
extend: {
|
180
|
-
version: '2.2.3',
|
181
|
-
|
182
|
-
EVENTS: $w('change'),
|
183
|
-
|
184
|
-
Options: {
|
185
|
-
min: 0, // the min value
|
186
|
-
max: 100, // the max value
|
187
|
-
snap: 0, // the values threshold
|
188
|
-
value: null, // start value, if null then the min value will be used
|
189
|
-
direction: 'x', // slider direction 'x', 'y'
|
190
|
-
update: null, // reference to an element to update
|
191
|
-
round: 0 // the number of symbols after the decimal pointer
|
192
|
-
},
|
193
|
-
|
194
|
-
current: false
|
195
|
-
},
|
196
|
-
|
197
|
-
/**
|
198
|
-
* basic constructor
|
199
|
-
* USAGE:
|
200
|
-
* new Slider('element-id'[, {options}]);
|
201
|
-
* new Slider({options});
|
202
|
-
*
|
203
|
-
* @param mixed slider element reference or options
|
204
|
-
* @param Object options
|
205
|
-
*/
|
206
|
-
initialize: function() {
|
207
|
-
var args = $A(arguments).compact(), options = args.pop(), element = args.pop();
|
208
|
-
|
209
|
-
// figuring out the arguments
|
210
|
-
if (!isHash(options) || options instanceof Element) {
|
211
|
-
element = $(element || options);
|
212
|
-
options = {};
|
213
|
-
}
|
214
|
-
|
215
|
-
this.$super('slider', element).setOptions(options)
|
216
|
-
.on('selectstart', 'stopEvent'); // disable select under IE
|
217
|
-
|
218
|
-
this.level = this.first('.level') || $E('div', {'class': 'level'}).insertTo(this);
|
219
|
-
this.handle = this.first('.handle') || $E('div', {'class': 'handle'}).insertTo(this);
|
220
|
-
|
221
|
-
options = this.options;
|
222
|
-
this.value = options.value === null ? options.min : options.value;
|
223
|
-
|
224
|
-
if (options.update) { this.assignTo(options.update); }
|
225
|
-
if (options.direction === 'y') { this.addClass('rui-slider-vertical'); }
|
226
|
-
else if (this.hasClass('rui-slider-vertical')) { options.direction = 'y'; }
|
227
|
-
|
228
|
-
this.setValue(this.value);
|
229
|
-
},
|
230
|
-
|
231
|
-
/**
|
232
|
-
* The value setter
|
233
|
-
*
|
234
|
-
* NOTE: will get snapped according to the options
|
235
|
-
*
|
236
|
-
* @param mixed string or number value
|
237
|
-
* @return Slider this
|
238
|
-
*/
|
239
|
-
setValue: function(value) {
|
240
|
-
return this.precalc().shiftTo(value);
|
241
|
-
},
|
242
|
-
|
243
|
-
/**
|
244
|
-
* Returns the value
|
245
|
-
*
|
246
|
-
* @return Float number
|
247
|
-
*/
|
248
|
-
getValue: function() {
|
249
|
-
return this.value;
|
250
|
-
},
|
251
|
-
|
252
|
-
/**
|
253
|
-
* Inserts the widget into the element
|
254
|
-
*
|
255
|
-
* @param mixed element reference
|
256
|
-
* @param String optional position
|
257
|
-
* @return Slider this
|
258
|
-
*/
|
259
|
-
insertTo: function(element, position) {
|
260
|
-
return this.$super(element, position).setValue(this.value);
|
261
|
-
},
|
262
|
-
|
263
|
-
// protected
|
264
|
-
|
265
|
-
// precalculates dimensions, direction and offset for further use
|
266
|
-
precalc: function() {
|
267
|
-
var horizontal = this.options.direction === 'x',
|
268
|
-
handle = this.handle.setStyle(horizontal ? {left: 0} : {bottom: 0}).dimensions(),
|
269
|
-
handle_size = this.hSize = horizontal ? handle.width : handle.height,
|
270
|
-
dims = this.dims = this.dimensions();
|
271
|
-
|
272
|
-
this.offset = horizontal ? handle.left - dims.left : dims.top + dims.height - handle.top - handle_size;
|
273
|
-
this.space = (horizontal ? dims.width : dims.height) - handle_size - this.offset * 2;
|
274
|
-
|
275
|
-
return this;
|
276
|
-
},
|
277
|
-
|
278
|
-
// initializes the slider drag
|
279
|
-
start: function(event) {
|
280
|
-
return this.precalc().e2val(event);
|
281
|
-
},
|
282
|
-
|
283
|
-
// processes the slider-drag
|
284
|
-
move: function(event) {
|
285
|
-
return this.e2val(event);
|
286
|
-
},
|
287
|
-
|
288
|
-
// shifts the slider to the value
|
289
|
-
shiftTo: function(value) {
|
290
|
-
var options = this.options, base = Math.pow(10, options.round), horizontal = options.direction === 'x';
|
291
|
-
|
292
|
-
// rounding the value up
|
293
|
-
value = Math.round(value * base) / base;
|
294
|
-
|
295
|
-
// checking the value constraings
|
296
|
-
if (value < options.min) { value = options.min; }
|
297
|
-
if (value > options.max) { value = options.max; }
|
298
|
-
if (options.snap) {
|
299
|
-
var snap = options.snap;
|
300
|
-
var diff = (value - options.min) % snap;
|
301
|
-
value = diff < snap/2 ? value - diff : value - diff + snap;
|
302
|
-
}
|
303
|
-
|
304
|
-
// calculating and setting the actual position
|
305
|
-
var position = this.space / (options.max - options.min) * (value - options.min);
|
306
|
-
|
307
|
-
this.handle._.style[horizontal ? 'left' : 'bottom'] = position + 'px';
|
308
|
-
this.level._.style[horizontal ? 'width': 'height'] = ((position > 0 ? position : 0) + 2) + 'px';
|
309
|
-
|
310
|
-
// checking the change status
|
311
|
-
if (value !== this.value) {
|
312
|
-
this.value = value;
|
313
|
-
this.fire('change', {value: value});
|
314
|
-
}
|
315
|
-
|
316
|
-
return this;
|
317
|
-
},
|
318
|
-
|
319
|
-
// converts the event position into the actual value in terms of the slider measures
|
320
|
-
e2val: function(event) {
|
321
|
-
var options = this.options, horizontal = options.direction === 'x',
|
322
|
-
dims = this.dims, offset = this.offset, space = this.space,
|
323
|
-
cur_pos = event.position()[horizontal ? 'x' : 'y'] - offset - this.hSize/2,
|
324
|
-
min_pos = horizontal ? dims.left + offset : dims.top + offset,
|
325
|
-
value = (options.max - options.min) / space * (cur_pos - min_pos);
|
326
|
-
|
327
|
-
return this.shiftTo(horizontal ? options.min + value : options.max - value);
|
328
|
-
}
|
329
|
-
});
|
330
|
-
|
331
|
-
|
332
|
-
/**
|
333
|
-
* Document onReady hook for sliders
|
334
|
-
*
|
335
|
-
* Copyright (C) 2009-2010 Nikolay Nemshilov
|
336
|
-
*/
|
337
|
-
$(document).on({
|
338
|
-
// preinitializing the sliders
|
339
|
-
ready: function() {
|
340
|
-
$$('.rui-slider').each(function(element) {
|
341
|
-
if (!(element instanceof Slider)) {
|
342
|
-
element = new Slider(element);
|
343
|
-
}
|
344
|
-
});
|
345
|
-
},
|
346
|
-
|
347
|
-
// initiates the slider move
|
348
|
-
mousedown: function(event) {
|
349
|
-
var slider = event.find('.rui-slider');
|
350
|
-
if (slider) {
|
351
|
-
event.stop();
|
352
|
-
if (!(slider instanceof Slider)) {
|
353
|
-
slider = new Slider(slider);
|
354
|
-
}
|
355
|
-
Slider.current = slider.start(event);
|
356
|
-
}
|
357
|
-
},
|
358
|
-
|
359
|
-
// handles the slider move
|
360
|
-
mousemove: function(event) {
|
361
|
-
if (Slider.current) {
|
362
|
-
Slider.current.move(event);
|
363
|
-
}
|
364
|
-
},
|
365
|
-
|
366
|
-
// handles the slider release
|
367
|
-
mouseup: function(event) {
|
368
|
-
if (Slider.current) {
|
369
|
-
Slider.current = false;
|
370
|
-
}
|
371
|
-
}
|
372
|
-
});
|
373
|
-
|
374
|
-
$(window).onBlur(function() {
|
375
|
-
if (Slider.current) {
|
376
|
-
Slider.current = false;
|
377
|
-
}
|
378
|
-
});
|
379
|
-
|
380
|
-
|
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
|
-
|
393
|
-
|
394
|
-
return Slider;
|
395
|
-
})(document, Math, RightJS);
|
@@ -1,7 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* RightJS-UI Slider v2.2.3
|
3
|
-
* http://rightjs.org/ui/slider
|
4
|
-
*
|
5
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
|
-
*/
|
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||c([]));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.3",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: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-c.min)%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,430 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* RightJS-UI Sortable v2.2.0
|
3
|
-
* http://rightjs.org/ui/sortable
|
4
|
-
*
|
5
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
|
-
*/
|
7
|
-
var Sortable = RightJS.Sortable = (function(document, RightJS) {
|
8
|
-
/**
|
9
|
-
* This module defines the basic widgets constructor
|
10
|
-
* it creates an abstract proxy with the common functionality
|
11
|
-
* which then we reuse and override in the actual widgets
|
12
|
-
*
|
13
|
-
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
14
|
-
*/
|
15
|
-
|
16
|
-
/**
|
17
|
-
* The widget units constructor
|
18
|
-
*
|
19
|
-
* @param String tag-name or Object methods
|
20
|
-
* @param Object methods
|
21
|
-
* @return Widget wrapper
|
22
|
-
*/
|
23
|
-
function Widget(tag_name, methods) {
|
24
|
-
if (!methods) {
|
25
|
-
methods = tag_name;
|
26
|
-
tag_name = 'DIV';
|
27
|
-
}
|
28
|
-
|
29
|
-
/**
|
30
|
-
* An Abstract Widget Unit
|
31
|
-
*
|
32
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
33
|
-
*/
|
34
|
-
var AbstractWidget = new RightJS.Class(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
|
35
|
-
/**
|
36
|
-
* The common constructor
|
37
|
-
*
|
38
|
-
* @param Object options
|
39
|
-
* @param String optional tag name
|
40
|
-
* @return void
|
41
|
-
*/
|
42
|
-
initialize: function(key, options) {
|
43
|
-
this.key = key;
|
44
|
-
var args = [{'class': 'rui-' + key}];
|
45
|
-
|
46
|
-
// those two have different constructors
|
47
|
-
if (!(this instanceof RightJS.Input || this instanceof RightJS.Form)) {
|
48
|
-
args.unshift(tag_name);
|
49
|
-
}
|
50
|
-
this.$super.apply(this, args);
|
51
|
-
|
52
|
-
if (RightJS.isString(options)) {
|
53
|
-
options = RightJS.$(options);
|
54
|
-
}
|
55
|
-
|
56
|
-
// if the options is another element then
|
57
|
-
// try to dynamically rewrap it with our widget
|
58
|
-
if (options instanceof RightJS.Element) {
|
59
|
-
this._ = options._;
|
60
|
-
if ('$listeners' in options) {
|
61
|
-
options.$listeners = options.$listeners;
|
62
|
-
}
|
63
|
-
options = {};
|
64
|
-
}
|
65
|
-
this.setOptions(options, this);
|
66
|
-
|
67
|
-
return (RightJS.Wrapper.Cache[RightJS.$uid(this._)] = this);
|
68
|
-
},
|
69
|
-
|
70
|
-
// protected
|
71
|
-
|
72
|
-
/**
|
73
|
-
* Catches the options
|
74
|
-
*
|
75
|
-
* @param Object user-options
|
76
|
-
* @param Element element with contextual options
|
77
|
-
* @return void
|
78
|
-
*/
|
79
|
-
setOptions: function(options, element) {
|
80
|
-
if (element) {
|
81
|
-
options = RightJS.Object.merge(options, new Function("return "+(
|
82
|
-
element.get('data-'+ this.key) || '{}'
|
83
|
-
))());
|
84
|
-
}
|
85
|
-
|
86
|
-
if (options) {
|
87
|
-
RightJS.Options.setOptions.call(this, RightJS.Object.merge(this.options, options));
|
88
|
-
}
|
89
|
-
|
90
|
-
return this;
|
91
|
-
}
|
92
|
-
});
|
93
|
-
|
94
|
-
/**
|
95
|
-
* Creating the actual widget class
|
96
|
-
*
|
97
|
-
*/
|
98
|
-
var Klass = new RightJS.Class(AbstractWidget, methods);
|
99
|
-
|
100
|
-
// creating the widget related shortcuts
|
101
|
-
RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || RightJS([]));
|
102
|
-
|
103
|
-
return Klass;
|
104
|
-
}
|
105
|
-
|
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
|
-
|
122
|
-
/**
|
123
|
-
* The Sortable unit
|
124
|
-
*
|
125
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
126
|
-
*/
|
127
|
-
var Sortable = new Widget('UL', {
|
128
|
-
extend: {
|
129
|
-
version: '2.2.0',
|
130
|
-
|
131
|
-
EVENTS: $w('start change finish'),
|
132
|
-
|
133
|
-
Options: {
|
134
|
-
url: null, // the Xhr requests url address, might contain the '%{id}' placeholder
|
135
|
-
method: 'put', // the Xhr requests method
|
136
|
-
|
137
|
-
Xhr: {}, // additional Xhr options
|
138
|
-
|
139
|
-
idParam: 'id', // the id value name
|
140
|
-
posParam: 'position', // the position value name
|
141
|
-
parseId: true, // if the id attribute should be converted into an integer before sending
|
142
|
-
|
143
|
-
dragClass: 'dragging', // the in-process class name
|
144
|
-
accept: null, // a reference or a list of references to the other sortables between which you can drag the items
|
145
|
-
minLength: 1, // minimum number of items on the list when the feature works
|
146
|
-
|
147
|
-
itemCss: 'li', // the draggable item's css rule
|
148
|
-
handleCss: 'li', // the draggables handle element css rule
|
149
|
-
|
150
|
-
cssRule: '*[data-sortable]' // css-rule for automatically initializable sortables
|
151
|
-
},
|
152
|
-
|
153
|
-
current: false, // a reference to the currently active sortable
|
154
|
-
|
155
|
-
/**
|
156
|
-
* Typecasting the list element for Sortable
|
157
|
-
*
|
158
|
-
* @param Element list
|
159
|
-
* @return Sortable list
|
160
|
-
*/
|
161
|
-
cast: function(element) {
|
162
|
-
element = $(element._);
|
163
|
-
if (!(element instanceof Sortable)) {
|
164
|
-
element = new Sortable(element);
|
165
|
-
}
|
166
|
-
return element;
|
167
|
-
}
|
168
|
-
},
|
169
|
-
|
170
|
-
/**
|
171
|
-
* basic constructor
|
172
|
-
*
|
173
|
-
* @param mixed element reference
|
174
|
-
* @param Object options
|
175
|
-
* @return void
|
176
|
-
*/
|
177
|
-
initialize: function(element, options) {
|
178
|
-
this.$super('sortable', element)
|
179
|
-
.setOptions(options)
|
180
|
-
.addClass('rui-sortable')
|
181
|
-
.on('finish', this._tryXhr)
|
182
|
-
.on('selectstart', 'stopEvent'); // disable select under IE
|
183
|
-
},
|
184
|
-
|
185
|
-
/**
|
186
|
-
* some additional options processing
|
187
|
-
*
|
188
|
-
* @param Object options
|
189
|
-
* @param Element optional context
|
190
|
-
* @return Sortable this
|
191
|
-
*/
|
192
|
-
setOptions: function(options, context) {
|
193
|
-
this.$super(options, context);
|
194
|
-
|
195
|
-
options = this.options;
|
196
|
-
|
197
|
-
// Preprocessing the acceptance list
|
198
|
-
var list = options.accept || [];
|
199
|
-
if (!isArray(list)) { list = [list]; }
|
200
|
-
|
201
|
-
options.accept = R([this].concat(list)).map($).uniq();
|
202
|
-
|
203
|
-
return this;
|
204
|
-
},
|
205
|
-
|
206
|
-
// returns a list of draggable items
|
207
|
-
items: function() {
|
208
|
-
return this.children(this.options.itemCss);
|
209
|
-
},
|
210
|
-
|
211
|
-
// protected
|
212
|
-
|
213
|
-
// starts the drag
|
214
|
-
startDrag: function(event) {
|
215
|
-
// don't let to drag out the last item
|
216
|
-
if (this.items().length <= this.options.minLength) { return; }
|
217
|
-
|
218
|
-
// trying to find the list-item upon which the user pressed the mouse
|
219
|
-
var item = event.find(this.options.itemCss),
|
220
|
-
handle = event.find(this.options.handleCss);
|
221
|
-
|
222
|
-
if (item && handle) {
|
223
|
-
this._initDrag(item, event.position());
|
224
|
-
Sortable.current = this;
|
225
|
-
this.fire('start', this._evOpts(event));
|
226
|
-
}
|
227
|
-
},
|
228
|
-
|
229
|
-
// moves the item
|
230
|
-
moveItem: function(event) {
|
231
|
-
var event_pos = event.position(),
|
232
|
-
item = this.itemClone._.style,
|
233
|
-
top = event_pos.y - this.yRDiff,
|
234
|
-
left = event_pos.x - this.xRDiff,
|
235
|
-
right = left + this.cloneWidth,
|
236
|
-
bottom = top + this.cloneHeight;
|
237
|
-
|
238
|
-
// moving the clone
|
239
|
-
item.top = (event_pos.y - this.yDiff) + 'px';
|
240
|
-
item.left = (event_pos.x - this.xDiff) + 'px';
|
241
|
-
|
242
|
-
// checking for an overlaping item
|
243
|
-
var over_item = this.suspects.first(function(suspect) {
|
244
|
-
return (
|
245
|
-
(top > suspect.top && top < suspect.topHalf) ||
|
246
|
-
(bottom < suspect.bottom && bottom > suspect.topHalf)
|
247
|
-
) && (
|
248
|
-
(left > suspect.left && left < suspect.leftHalf) ||
|
249
|
-
(right < suspect.right && right > suspect.leftHalf)
|
250
|
-
);
|
251
|
-
});
|
252
|
-
|
253
|
-
if (over_item) {
|
254
|
-
item = over_item.item;
|
255
|
-
item.insert(this.item, item.prevSiblings().include(this.item) ? 'after' : 'before');
|
256
|
-
this._findSuspects();
|
257
|
-
|
258
|
-
this.fire('change', this._evOpts(event, item));
|
259
|
-
}
|
260
|
-
},
|
261
|
-
|
262
|
-
// finalizes the drag
|
263
|
-
finishDrag: function(event) {
|
264
|
-
if (this.itemClone) {
|
265
|
-
this.itemClone.remove();
|
266
|
-
this.item.setStyle('visibility:visible');
|
267
|
-
}
|
268
|
-
Sortable.current = false;
|
269
|
-
this.fire('finish', this._evOpts(event));
|
270
|
-
},
|
271
|
-
|
272
|
-
// returns the event options
|
273
|
-
_evOpts: function(event, item) {
|
274
|
-
item = item || this.item;
|
275
|
-
var list = Sortable.cast(item.parent());
|
276
|
-
|
277
|
-
return {
|
278
|
-
list: list,
|
279
|
-
item: item,
|
280
|
-
event: event,
|
281
|
-
index: list.items().indexOf(item)
|
282
|
-
};
|
283
|
-
},
|
284
|
-
|
285
|
-
_initDrag: function(item, event_pos) {
|
286
|
-
var dims = this.dimensions(), item_dims = item.dimensions();
|
287
|
-
|
288
|
-
// creating the draggable clone
|
289
|
-
var clone = item.clone().setStyle({
|
290
|
-
margin: 0,
|
291
|
-
zIndex: 9999,
|
292
|
-
position: 'absolute',
|
293
|
-
top: '0px',
|
294
|
-
left: '0px'
|
295
|
-
})
|
296
|
-
.addClass(this.options.dragClass).insertTo(this)
|
297
|
-
.setHeight(this.cloneHeight = item_dims.height)
|
298
|
-
.setWidth(this.cloneWidth = item_dims.width);
|
299
|
-
|
300
|
-
// adjusting the clone position to compensate relative fields and margins
|
301
|
-
var clone_pos = clone.position(),
|
302
|
-
real_x = item_dims.left - clone_pos.x,
|
303
|
-
real_y = item_dims.top - clone_pos.y;
|
304
|
-
|
305
|
-
clone.moveTo(real_x, real_y);
|
306
|
-
|
307
|
-
this.item = item.setStyle('visibility:hidden');
|
308
|
-
this.itemClone = clone;
|
309
|
-
|
310
|
-
// mouse event-position diffs
|
311
|
-
this.xDiff = event_pos.x - real_x;
|
312
|
-
this.yDiff = event_pos.y - real_y;
|
313
|
-
this.xRDiff = event_pos.x - clone.position().x;
|
314
|
-
this.yRDiff = event_pos.y - clone.position().y;
|
315
|
-
|
316
|
-
// collecting the list of interchangable items with their positions
|
317
|
-
this._findSuspects();
|
318
|
-
},
|
319
|
-
|
320
|
-
// collects the precached list of suspects
|
321
|
-
_findSuspects: function() {
|
322
|
-
var suspects = this.suspects = R([]), item = this.item, clone = this.itemClone;
|
323
|
-
this.options.accept.each(function(list) {
|
324
|
-
Sortable.cast(list).items().each(function(element) {
|
325
|
-
if (element !== item && element !== clone) {
|
326
|
-
var dims = element.dimensions();
|
327
|
-
|
328
|
-
// caching the sizes
|
329
|
-
suspects.push({
|
330
|
-
item: element,
|
331
|
-
top: dims.top,
|
332
|
-
left: dims.left,
|
333
|
-
right: dims.left + dims.width,
|
334
|
-
bottom: dims.top + dims.height,
|
335
|
-
topHalf: dims.top + dims.height/2,
|
336
|
-
leftHalf: dims.left + dims.width/2
|
337
|
-
});
|
338
|
-
}
|
339
|
-
});
|
340
|
-
});
|
341
|
-
},
|
342
|
-
|
343
|
-
// tries to send an Xhr request about the element relocation
|
344
|
-
_tryXhr: function(event) {
|
345
|
-
if (this.options.url) {
|
346
|
-
var url = R(this.options.url), params = {}, item = event.item, position = event.index + 1;
|
347
|
-
|
348
|
-
// building the Xhr request options
|
349
|
-
var options = Object.merge({
|
350
|
-
method: this.options.method,
|
351
|
-
params: {}
|
352
|
-
}, this.options.Xhr);
|
353
|
-
|
354
|
-
// grabbing the id
|
355
|
-
var id = item.get('id') || '';
|
356
|
-
if (this.options.parseId && id) {
|
357
|
-
id = (id.match(/\d+/) || [''])[0];
|
358
|
-
}
|
359
|
-
|
360
|
-
// assigning the parameters
|
361
|
-
if (url.include('%{id}')) {
|
362
|
-
url = url.replace('%{id}', id);
|
363
|
-
} else {
|
364
|
-
params[this.options.idParam] = id;
|
365
|
-
}
|
366
|
-
params[this.options.posParam] = position;
|
367
|
-
|
368
|
-
// merging the params with possible Xhr params
|
369
|
-
if (isString(options.params)) {
|
370
|
-
options.params += '&'+Object.toQueryString(params);
|
371
|
-
} else {
|
372
|
-
options.params = Object.merge(options.params, params);
|
373
|
-
}
|
374
|
-
|
375
|
-
// calling the server
|
376
|
-
RightJS.Xhr.load(url, options);
|
377
|
-
}
|
378
|
-
}
|
379
|
-
});
|
380
|
-
|
381
|
-
|
382
|
-
/**
|
383
|
-
* Document level hooks for sortables
|
384
|
-
*
|
385
|
-
* Copyright (C) 2009-2010 Nikolay Nemshilov
|
386
|
-
*/
|
387
|
-
$(document).on({
|
388
|
-
mousedown: function(event) {
|
389
|
-
var element = event.find(Sortable.Options.cssRule+",*.rui-sortable");
|
390
|
-
|
391
|
-
if (element) {
|
392
|
-
Sortable.cast(element).startDrag(event);
|
393
|
-
}
|
394
|
-
},
|
395
|
-
|
396
|
-
mousemove: function(event) {
|
397
|
-
if (Sortable.current) {
|
398
|
-
Sortable.current.moveItem(event);
|
399
|
-
}
|
400
|
-
},
|
401
|
-
|
402
|
-
mouseup: function(event) {
|
403
|
-
if (Sortable.current) {
|
404
|
-
Sortable.current.finishDrag(event);
|
405
|
-
}
|
406
|
-
}
|
407
|
-
});
|
408
|
-
|
409
|
-
$(window).onBlur(function() {
|
410
|
-
if (Sortable.current) {
|
411
|
-
Sortable.current.finishDrag();
|
412
|
-
}
|
413
|
-
});
|
414
|
-
|
415
|
-
|
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
|
-
|
428
|
-
|
429
|
-
return Sortable;
|
430
|
-
})(document, RightJS);
|