You've already forked joomla_test
first commit
This commit is contained in:
130
media/jui/js/ajax-chosen.js
Normal file
130
media/jui/js/ajax-chosen.js
Normal file
@ -0,0 +1,130 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
|
||||
|
||||
/* USING JOOMLA.JTEXT TO TRANSLATE LANGUAGE STRINGS
|
||||
* ================================================= */
|
||||
|
||||
|
||||
(function($) {
|
||||
return $.fn.ajaxChosen = function(settings, callback, chosenOptions) {
|
||||
var chosenXhr, defaultOptions, options, select;
|
||||
if (settings == null) {
|
||||
settings = {};
|
||||
}
|
||||
if (callback == null) {
|
||||
callback = {};
|
||||
}
|
||||
if (chosenOptions == null) {
|
||||
chosenOptions = function() {};
|
||||
}
|
||||
defaultOptions = {
|
||||
minTermLength: 3,
|
||||
afterTypeDelay: 500,
|
||||
jsonTermKey: "term",
|
||||
keepTypingMsg: Joomla.JText._('JGLOBAL_KEEP_TYPING'),
|
||||
lookingForMsg: Joomla.JText._('JGLOBAL_LOOKING_FOR')
|
||||
};
|
||||
select = this;
|
||||
chosenXhr = null;
|
||||
options = $.extend({}, defaultOptions, $(select).data(), settings);
|
||||
this.chosen(chosenOptions ? chosenOptions : {});
|
||||
return this.each(function() {
|
||||
return $(this).next('.chzn-container').find(".search-field > input, .chzn-search > input").bind('keyup', function() {
|
||||
var field, msg, success, untrimmed_val, val;
|
||||
untrimmed_val = $(this).val();
|
||||
val = $.trim($(this).val());
|
||||
msg = val.length < options.minTermLength ? options.keepTypingMsg : options.lookingForMsg + (" '" + val + "'");
|
||||
select.next('.chzn-container').find('.no-results').text(msg);
|
||||
if (val === $(this).data('prevVal')) {
|
||||
return false;
|
||||
}
|
||||
$(this).data('prevVal', val);
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
if (val.length < options.minTermLength) {
|
||||
return false;
|
||||
}
|
||||
field = $(this);
|
||||
if (!(options.data != null)) {
|
||||
options.data = {};
|
||||
}
|
||||
options.data[options.jsonTermKey] = val;
|
||||
if (options.dataCallback != null) {
|
||||
options.data = options.dataCallback(options.data);
|
||||
}
|
||||
success = options.success;
|
||||
options.success = function(data) {
|
||||
var items, nbItems, selected_values;
|
||||
if (!(data != null)) {
|
||||
return;
|
||||
}
|
||||
selected_values = [];
|
||||
select.find('option').each(function() {
|
||||
if (!$(this).is(":selected")) {
|
||||
return $(this).remove();
|
||||
} else {
|
||||
return selected_values.push($(this).val() + "-" + $(this).text());
|
||||
}
|
||||
});
|
||||
select.find('optgroup:empty').each(function() {
|
||||
return $(this).remove();
|
||||
});
|
||||
items = callback(data);
|
||||
nbItems = 0;
|
||||
$.each(items, function(i, element) {
|
||||
var group, text, value;
|
||||
nbItems++;
|
||||
if (element.group) {
|
||||
group = select.find("optgroup[label='" + element.text + "']");
|
||||
if (!group.size()) {
|
||||
group = $("<optgroup />");
|
||||
}
|
||||
group.attr('label', element.text).appendTo(select);
|
||||
return $.each(element.items, function(i, element) {
|
||||
var text, value;
|
||||
if (typeof element === "string") {
|
||||
value = i;
|
||||
text = element;
|
||||
} else {
|
||||
value = element.value;
|
||||
text = element.text;
|
||||
}
|
||||
if ($.inArray(value + "-" + text, selected_values) === -1) {
|
||||
return $("<option />").attr('value', value).html(text).appendTo(group);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (typeof element === "string") {
|
||||
value = i;
|
||||
text = element;
|
||||
} else {
|
||||
value = element.value;
|
||||
text = element.text;
|
||||
}
|
||||
if ($.inArray(value + "-" + text, selected_values) === -1) {
|
||||
return $("<option />").attr('value', value).html(text).appendTo(select);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (nbItems) {
|
||||
select.trigger("liszt:updated");
|
||||
} else {
|
||||
select.data().chosen.no_results_clear();
|
||||
select.data().chosen.no_results(field.val());
|
||||
}
|
||||
if (success != null) {
|
||||
success(data);
|
||||
}
|
||||
return field.val(untrimmed_val);
|
||||
};
|
||||
return this.timer = setTimeout(function() {
|
||||
if (chosenXhr) {
|
||||
chosenXhr.abort();
|
||||
}
|
||||
return chosenXhr = $.ajax(options);
|
||||
}, options.afterTypeDelay);
|
||||
});
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
17
media/jui/js/ajax-chosen.min.js
vendored
Normal file
17
media/jui/js/ajax-chosen.min.js
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
(function($){return $.fn.ajaxChosen=function(settings,callback,chosenOptions){var chosenXhr,defaultOptions,options,select;if(settings==null){settings={};}
|
||||
if(callback==null){callback={};}
|
||||
if(chosenOptions==null){chosenOptions=function(){};}
|
||||
defaultOptions={minTermLength:3,afterTypeDelay:500,jsonTermKey:"term",keepTypingMsg:Joomla.JText._('JGLOBAL_KEEP_TYPING'),lookingForMsg:Joomla.JText._('JGLOBAL_LOOKING_FOR')};select=this;chosenXhr=null;options=$.extend({},defaultOptions,$(select).data(),settings);this.chosen(chosenOptions?chosenOptions:{});return this.each(function(){return $(this).next('.chzn-container').find(".search-field > input, .chzn-search > input").bind('keyup',function(){var field,msg,success,untrimmed_val,val;untrimmed_val=$(this).attr('value');val=$.trim($(this).attr('value'));msg=val.length<options.minTermLength?options.keepTypingMsg:options.lookingForMsg+(" '"+val+"'");select.next('.chzn-container').find('.no-results').text(msg);if(val===$(this).data('prevVal')){return false;}
|
||||
$(this).data('prevVal',val);if(this.timer){clearTimeout(this.timer);}
|
||||
if(val.length<options.minTermLength){return false;}
|
||||
field=$(this);if(!(options.data!=null)){options.data={};}
|
||||
options.data[options.jsonTermKey]=val;if(options.dataCallback!=null){options.data=options.dataCallback(options.data);}
|
||||
success=options.success;options.success=function(data){var items,selected_values;if(!(data!=null)){return;}
|
||||
selected_values=[];select.find('option').each(function(){if(!$(this).is(":selected")){return $(this).remove();}else{return selected_values.push($(this).val()+"-"+$(this).text());}});select.find('optgroup:empty').each(function(){return $(this).remove();});items=callback(data);$.each(items,function(i,element){var group,text,value;if(element.group){group=select.find("optgroup[label='"+element.text+"']");if(!group.size()){group=$("<optgroup />");}
|
||||
group.attr('label',element.text).appendTo(select);return $.each(element.items,function(i,element){var text,value;if(typeof element==="string"){value=i;text=element;}else{value=element.value;text=element.text;}
|
||||
if($.inArray(value+"-"+text,selected_values)===-1){return $("<option />").attr('value',value).html(text).appendTo(group);}});}else{if(typeof element==="string"){value=i;text=element;}else{value=element.value;text=element.text;}
|
||||
if($.inArray(value+"-"+text,selected_values)===-1){return $("<option />").attr('value',value).html(text).appendTo(select);}}});if(Object.keys(items).length){select.trigger("liszt:updated");}else{select.data().chosen.no_results_clear();select.data().chosen.no_results(field.attr('value'));}
|
||||
if(success!=null){success(data);}
|
||||
return field.attr('value',untrimmed_val);};return this.timer=setTimeout(function(){if(chosenXhr){chosenXhr.abort();}
|
||||
return chosenXhr=$.ajax(options);},options.afterTypeDelay);});});};})(jQuery);
|
2332
media/jui/js/bootstrap.js
vendored
Normal file
2332
media/jui/js/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
media/jui/js/bootstrap.min.js
vendored
Normal file
6
media/jui/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1113
media/jui/js/chosen.jquery.js
Normal file
1113
media/jui/js/chosen.jquery.js
Normal file
File diff suppressed because it is too large
Load Diff
13
media/jui/js/chosen.jquery.min.js
vendored
Normal file
13
media/jui/js/chosen.jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
50
media/jui/js/cms.js
Normal file
50
media/jui/js/cms.js
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Only define the Joomla namespace if not defined.
|
||||
if (typeof(Joomla) === 'undefined') {
|
||||
var Joomla = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTML of the container-collapse element
|
||||
*/
|
||||
Joomla.setcollapse = function(url, name, height) {
|
||||
if (!document.getElementById('collapse-' + name)) {
|
||||
document.getElementById('container-collapse').innerHTML = '<div class="collapse fade" id="collapse-' + name + '"><iframe class="iframe" src="' + url + '" height="'+ height + '" width="100%"></iframe></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (jQuery) {
|
||||
jQuery(document).ready(function($) {
|
||||
var elements = {},
|
||||
linkedoptions = function(element, target, checkType) {
|
||||
var v = element.val(), id = element.attr('id');
|
||||
if(checkType && !element.is(':checked'))
|
||||
return;
|
||||
$('[rel=\"showon_'+target+'\"]').each(function(){
|
||||
var i = jQuery(this);
|
||||
if (i.hasClass('showon_' + v))
|
||||
i.show();
|
||||
else
|
||||
i.hide();
|
||||
});
|
||||
};
|
||||
$('[rel^=\"showon_\"]').each(function(){
|
||||
var el = $(this), target = el.attr('rel').replace('showon_', ''), targetEl = $('[name=\"' + target+'\"]');
|
||||
if (!elements[target]) {
|
||||
var targetType = targetEl.attr('type'), checkType = (targetType == 'checkbox' || targetType == 'radio');
|
||||
targetEl.bind('change', function(){
|
||||
linkedoptions( $(this), target, checkType);
|
||||
}).bind('click', function(){
|
||||
linkedoptions( $(this), target, checkType );
|
||||
}).each(function(){
|
||||
linkedoptions( $(this), target, checkType );
|
||||
});
|
||||
elements[target] = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
8
media/jui/js/html5.js
Normal file
8
media/jui/js/html5.js
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
HTML5 Shiv v3.6.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
|
||||
a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}</style>";
|
||||
c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
|
||||
"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video",version:"3.6.2",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment();
|
||||
for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
|
154
media/jui/js/icomoon-lte-ie7.js
Normal file
154
media/jui/js/icomoon-lte-ie7.js
Normal file
@ -0,0 +1,154 @@
|
||||
/* Use this script if you need to support IE 7 and IE 6. */
|
||||
|
||||
window.onload = function() {
|
||||
function addIcon(el, entity) {
|
||||
var html = el.innerHTML;
|
||||
el.innerHTML = '<span style="font-family: \'IcoMoon\'">' + entity + '</span>' + html;
|
||||
}
|
||||
var icons = {
|
||||
'icon-home' : '!',
|
||||
'icon-user' : '"',
|
||||
'icon-locked' : '#',
|
||||
'icon-comments' : '$',
|
||||
'icon-comments-2' : '%',
|
||||
'icon-out' : '&',
|
||||
'icon-redo' : ''',
|
||||
'icon-undo' : '(',
|
||||
'icon-file-add' : ')',
|
||||
'icon-plus' : '*',
|
||||
'icon-pencil' : '+',
|
||||
'icon-pencil-2' : ',',
|
||||
'icon-folder' : '-',
|
||||
'icon-folder-2' : '.',
|
||||
'icon-picture' : '/',
|
||||
'icon-pictures' : '0',
|
||||
'icon-list-view' : '1',
|
||||
'icon-power-cord' : '2',
|
||||
'icon-cube' : '3',
|
||||
'icon-puzzle' : '4',
|
||||
'icon-flag' : '5',
|
||||
'icon-tools' : '6',
|
||||
'icon-cogs' : '7',
|
||||
'icon-cog' : '8',
|
||||
'icon-equalizer' : '9',
|
||||
'icon-wrench' : ':',
|
||||
'icon-brush' : ';',
|
||||
'icon-eye' : '<',
|
||||
'icon-checkbox-unchecked' : '=',
|
||||
'icon-checkbox' : '>',
|
||||
'icon-checkbox-partial' : '?',
|
||||
'icon-star' : '@',
|
||||
'icon-star-2' : 'A',
|
||||
'icon-star-3' : 'B',
|
||||
'icon-calendar' : 'C',
|
||||
'icon-calendar-2' : 'D',
|
||||
'icon-help' : 'E',
|
||||
'icon-support' : 'F',
|
||||
'icon-warning' : 'H',
|
||||
'icon-checkmark' : 'G',
|
||||
'icon-cancel' : 'J',
|
||||
'icon-minus' : 'K',
|
||||
'icon-remove' : 'L',
|
||||
'icon-mail' : 'M',
|
||||
'icon-mail-2' : 'N',
|
||||
'icon-drawer' : 'O',
|
||||
'icon-drawer-2' : 'P',
|
||||
'icon-box-add' : 'Q',
|
||||
'icon-box-remove' : 'R',
|
||||
'icon-search' : 'S',
|
||||
'icon-filter' : 'T',
|
||||
'icon-camera' : 'U',
|
||||
'icon-play' : 'V',
|
||||
'icon-music' : 'W',
|
||||
'icon-grid-view' : 'X',
|
||||
'icon-grid-view-2' : 'Y',
|
||||
'icon-menu' : 'Z',
|
||||
'icon-thumbs-up' : '[',
|
||||
'icon-thumbs-down' : '\',
|
||||
'icon-cancel-2' : 'I',
|
||||
'icon-plus-2' : ']',
|
||||
'icon-minus-2' : '^',
|
||||
'icon-key' : '_',
|
||||
'icon-quote' : '`',
|
||||
'icon-quote-2' : 'a',
|
||||
'icon-database' : 'b',
|
||||
'icon-location' : 'c',
|
||||
'icon-zoom-in' : 'd',
|
||||
'icon-zoom-out' : 'e',
|
||||
'icon-expand' : 'f',
|
||||
'icon-contract' : 'g',
|
||||
'icon-expand-2' : 'h',
|
||||
'icon-contract-2' : 'i',
|
||||
'icon-health' : 'j',
|
||||
'icon-wand' : 'k',
|
||||
'icon-refresh' : 'l',
|
||||
'icon-vcard' : 'm',
|
||||
'icon-clock' : 'n',
|
||||
'icon-compass' : 'o',
|
||||
'icon-address' : 'p',
|
||||
'icon-feed' : 'q',
|
||||
'icon-flag-2' : 'r',
|
||||
'icon-pin' : 's',
|
||||
'icon-lamp' : 't',
|
||||
'icon-chart' : 'u',
|
||||
'icon-bars' : 'v',
|
||||
'icon-pie' : 'w',
|
||||
'icon-dashboard' : 'x',
|
||||
'icon-lightning' : 'y',
|
||||
'icon-move' : 'z',
|
||||
'icon-next' : '{',
|
||||
'icon-previous' : '|',
|
||||
'icon-first' : '}',
|
||||
'icon-last' : '',
|
||||
'icon-loop' : '',
|
||||
'icon-shuffle' : '',
|
||||
'icon-arrow-first' : '',
|
||||
'icon-arrow-last' : '',
|
||||
'icon-arrow-up' : '',
|
||||
'icon-arrow-right' : '',
|
||||
'icon-arrow-down' : '',
|
||||
'icon-arrow-left' : '',
|
||||
'icon-arrow-up-2' : '',
|
||||
'icon-arrow-right-2' : '',
|
||||
'icon-arrow-down-2' : '',
|
||||
'icon-arrow-left-2' : '',
|
||||
'icon-play-2' : '',
|
||||
'icon-menu-2' : '',
|
||||
'icon-arrow-up-3' : '',
|
||||
'icon-arrow-right-3' : '',
|
||||
'icon-arrow-down-3' : '',
|
||||
'icon-arrow-left-3' : '',
|
||||
'icon-printer' : '',
|
||||
'icon-color-palette' : '',
|
||||
'icon-camera-2' : '',
|
||||
'icon-file' : '',
|
||||
'icon-file-remove' : '',
|
||||
'icon-copy' : '',
|
||||
'icon-cart' : '',
|
||||
'icon-basket' : '',
|
||||
'icon-broadcast' : '',
|
||||
'icon-screen' : '',
|
||||
'icon-tablet' : '',
|
||||
'icon-mobile' : '',
|
||||
'icon-users' : '',
|
||||
'icon-briefcase' : '',
|
||||
'icon-download' : '',
|
||||
'icon-upload' : '',
|
||||
'icon-bookmark' : '',
|
||||
'icon-out-2' : ''
|
||||
},
|
||||
els = document.getElementsByTagName('*'),
|
||||
i, attr, html, c, el;
|
||||
for (i = 0; i < els.length; i += 1) {
|
||||
el = els[i];
|
||||
attr = el.getAttribute('data-icon');
|
||||
if (attr) {
|
||||
addIcon(el, attr);
|
||||
}
|
||||
c = el.className;
|
||||
c = c.match(/icon-[^s'"]+/);
|
||||
if (c) {
|
||||
addIcon(el, icons[c[0]]);
|
||||
}
|
||||
}
|
||||
};
|
1
media/jui/js/index.html
Normal file
1
media/jui/js/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
1
media/jui/js/jquery-noconflict.js
vendored
Normal file
1
media/jui/js/jquery-noconflict.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
jQuery.noConflict();
|
9472
media/jui/js/jquery.js
vendored
Normal file
9472
media/jui/js/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
media/jui/js/jquery.min.js
vendored
Normal file
2
media/jui/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
857
media/jui/js/jquery.minicolors.js
Normal file
857
media/jui/js/jquery.minicolors.js
Normal file
@ -0,0 +1,857 @@
|
||||
/*
|
||||
* jQuery MiniColors: A tiny color picker built on jQuery
|
||||
*
|
||||
* Copyright Cory LaViska for A Beautiful Site, LLC. (http://www.abeautifulsite.net/)
|
||||
*
|
||||
* Dual-licensed under the MIT and GPL Version 2 licenses
|
||||
*
|
||||
*/
|
||||
if(jQuery) (function($) {
|
||||
|
||||
// Yay, MiniColors!
|
||||
$.minicolors = {
|
||||
// Default settings
|
||||
defaultSettings: {
|
||||
animationSpeed: 100,
|
||||
animationEasing: 'swing',
|
||||
change: null,
|
||||
changeDelay: 0,
|
||||
control: 'hue',
|
||||
defaultValue: '',
|
||||
hide: null,
|
||||
hideSpeed: 100,
|
||||
inline: false,
|
||||
letterCase: 'lowercase',
|
||||
opacity: false,
|
||||
position: 'default',
|
||||
show: null,
|
||||
showSpeed: 100,
|
||||
swatchPosition: 'left',
|
||||
textfield: true,
|
||||
theme: 'default'
|
||||
}
|
||||
};
|
||||
|
||||
// Public methods
|
||||
$.extend($.fn, {
|
||||
minicolors: function(method, data) {
|
||||
|
||||
switch(method) {
|
||||
|
||||
// Destroy the control
|
||||
case 'destroy':
|
||||
$(this).each( function() {
|
||||
destroy($(this));
|
||||
});
|
||||
return $(this);
|
||||
|
||||
// Hide the color picker
|
||||
case 'hide':
|
||||
hide();
|
||||
return $(this);
|
||||
|
||||
// Get/set opacity
|
||||
case 'opacity':
|
||||
if( data === undefined ) {
|
||||
// Getter
|
||||
return $(this).attr('data-opacity');
|
||||
} else {
|
||||
// Setter
|
||||
$(this).each( function() {
|
||||
refresh($(this).attr('data-opacity', data));
|
||||
});
|
||||
return $(this);
|
||||
}
|
||||
|
||||
// Get an RGB(A) object based on the current color/opacity
|
||||
case 'rgbObject':
|
||||
return rgbObject($(this), method === 'rgbaObject');
|
||||
|
||||
// Get an RGB(A) string based on the current color/opacity
|
||||
case 'rgbString':
|
||||
case 'rgbaString':
|
||||
return rgbString($(this), method === 'rgbaString')
|
||||
|
||||
// Get/set settings on the fly
|
||||
case 'settings':
|
||||
if( data === undefined ) {
|
||||
return $(this).data('minicolors-settings');
|
||||
} else {
|
||||
// Setter
|
||||
$(this).each( function() {
|
||||
var settings = $(this).data('minicolors-settings') || {};
|
||||
destroy($(this));
|
||||
$(this).minicolors($.extend(true, settings, data));
|
||||
});
|
||||
return $(this);
|
||||
}
|
||||
|
||||
// Show the color picker
|
||||
case 'show':
|
||||
show( $(this).eq(0) );
|
||||
return $(this);
|
||||
|
||||
// Get/set the hex color value
|
||||
case 'value':
|
||||
if( data === undefined ) {
|
||||
// Getter
|
||||
return $(this).val();
|
||||
} else {
|
||||
// Setter
|
||||
$(this).each( function() {
|
||||
refresh($(this).val(data));
|
||||
});
|
||||
return $(this);
|
||||
}
|
||||
|
||||
// Initializes the control
|
||||
case 'create':
|
||||
default:
|
||||
if( method !== 'create' ) data = method;
|
||||
$(this).each( function() {
|
||||
init($(this), data);
|
||||
});
|
||||
return $(this);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize input elements
|
||||
function init(input, settings) {
|
||||
|
||||
var minicolors = $('<span class="minicolors" />'),
|
||||
defaultSettings = $.minicolors.defaultSettings;
|
||||
|
||||
// Do nothing if already initialized
|
||||
if( input.data('minicolors-initialized') ) return;
|
||||
|
||||
// Handle settings
|
||||
settings = $.extend(true, {}, defaultSettings, settings);
|
||||
|
||||
// The wrapper
|
||||
minicolors
|
||||
.addClass('minicolors-theme-' + settings.theme)
|
||||
.addClass('minicolors-swatch-position-' + settings.swatchPosition)
|
||||
.toggleClass('minicolors-swatch-left', settings.swatchPosition === 'left')
|
||||
.toggleClass('minicolors-with-opacity', settings.opacity);
|
||||
|
||||
// Custom positioning
|
||||
if( settings.position !== undefined ) {
|
||||
$.each(settings.position.split(' '), function() {
|
||||
minicolors.addClass('minicolors-position-' + this);
|
||||
});
|
||||
}
|
||||
|
||||
// The input
|
||||
input
|
||||
.addClass('minicolors-input')
|
||||
.data('minicolors-initialized', true)
|
||||
.data('minicolors-settings', settings)
|
||||
.prop('size', 7)
|
||||
.prop('maxlength', 7)
|
||||
.wrap(minicolors)
|
||||
.after(
|
||||
'<span class="minicolors-panel minicolors-slider-' + settings.control + '">' +
|
||||
'<span class="minicolors-slider">' +
|
||||
'<span class="minicolors-picker"></span>' +
|
||||
'</span>' +
|
||||
'<span class="minicolors-opacity-slider">' +
|
||||
'<span class="minicolors-picker"></span>' +
|
||||
'</span>' +
|
||||
'<span class="minicolors-grid">' +
|
||||
'<span class="minicolors-grid-inner"></span>' +
|
||||
'<span class="minicolors-picker"><span></span></span>' +
|
||||
'</span>' +
|
||||
'</span>'
|
||||
);
|
||||
|
||||
// Prevent text selection in IE
|
||||
input.parent().find('.minicolors-panel').on('selectstart', function() { return false; }).end();
|
||||
|
||||
// Detect swatch position
|
||||
if( settings.swatchPosition === 'left' ) {
|
||||
// Left
|
||||
input.before('<span class="minicolors-swatch"><span></span></span>');
|
||||
} else {
|
||||
// Right
|
||||
input.after('<span class="minicolors-swatch"><span></span></span>');
|
||||
}
|
||||
|
||||
// Disable textfield
|
||||
if( !settings.textfield ) input.addClass('minicolors-hidden');
|
||||
|
||||
// Inline controls
|
||||
if( settings.inline ) input.parent().addClass('minicolors-inline');
|
||||
|
||||
updateFromInput(input, false, true);
|
||||
|
||||
}
|
||||
|
||||
// Returns the input back to its original state
|
||||
function destroy(input) {
|
||||
|
||||
var minicolors = input.parent();
|
||||
|
||||
// Revert the input element
|
||||
input
|
||||
.removeData('minicolors-initialized')
|
||||
.removeData('minicolors-settings')
|
||||
.removeProp('size')
|
||||
.removeProp('maxlength')
|
||||
.removeClass('minicolors-input');
|
||||
|
||||
// Remove the wrap and destroy whatever remains
|
||||
minicolors.before(input).remove();
|
||||
|
||||
}
|
||||
|
||||
// Refresh the specified control
|
||||
function refresh(input) {
|
||||
updateFromInput(input);
|
||||
}
|
||||
|
||||
// Shows the specified dropdown panel
|
||||
function show(input) {
|
||||
|
||||
var minicolors = input.parent(),
|
||||
panel = minicolors.find('.minicolors-panel'),
|
||||
settings = input.data('minicolors-settings');
|
||||
|
||||
// Do nothing if uninitialized, disabled, inline, or already open
|
||||
if( !input.data('minicolors-initialized') ||
|
||||
input.prop('disabled') ||
|
||||
minicolors.hasClass('minicolors-inline') ||
|
||||
minicolors.hasClass('minicolors-focus')
|
||||
) return;
|
||||
|
||||
hide();
|
||||
|
||||
minicolors.addClass('minicolors-focus');
|
||||
panel
|
||||
.stop(true, true)
|
||||
.fadeIn(settings.showSpeed, function() {
|
||||
if( settings.show ) settings.show.call(input);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Hides all dropdown panels
|
||||
function hide() {
|
||||
|
||||
$('.minicolors-input').each( function() {
|
||||
|
||||
var input = $(this),
|
||||
settings = input.data('minicolors-settings'),
|
||||
minicolors = input.parent();
|
||||
|
||||
// Don't hide inline controls
|
||||
if( settings.inline ) return;
|
||||
|
||||
minicolors.find('.minicolors-panel').fadeOut(settings.hideSpeed, function() {
|
||||
if(minicolors.hasClass('minicolors-focus')) {
|
||||
if( settings.hide ) settings.hide.call(input);
|
||||
}
|
||||
minicolors.removeClass('minicolors-focus');
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// Moves the selected picker
|
||||
function move(target, event, animate) {
|
||||
|
||||
var input = target.parents('.minicolors').find('.minicolors-input'),
|
||||
settings = input.data('minicolors-settings'),
|
||||
picker = target.find('[class$=-picker]'),
|
||||
offsetX = target.offset().left,
|
||||
offsetY = target.offset().top,
|
||||
x = Math.round(event.pageX - offsetX),
|
||||
y = Math.round(event.pageY - offsetY),
|
||||
duration = animate ? settings.animationSpeed : 0,
|
||||
wx, wy, r, phi;
|
||||
|
||||
|
||||
// Touch support
|
||||
if( event.originalEvent.changedTouches ) {
|
||||
x = event.originalEvent.changedTouches[0].pageX - offsetX;
|
||||
y = event.originalEvent.changedTouches[0].pageY - offsetY;
|
||||
}
|
||||
|
||||
// Constrain picker to its container
|
||||
if( x < 0 ) x = 0;
|
||||
if( y < 0 ) y = 0;
|
||||
if( x > target.width() ) x = target.width();
|
||||
if( y > target.height() ) y = target.height();
|
||||
|
||||
// Constrain color wheel values to the wheel
|
||||
if( target.parent().is('.minicolors-slider-wheel') && picker.parent().is('.minicolors-grid') ) {
|
||||
wx = 75 - x;
|
||||
wy = 75 - y;
|
||||
r = Math.sqrt(wx * wx + wy * wy);
|
||||
phi = Math.atan2(wy, wx);
|
||||
if( phi < 0 ) phi += Math.PI * 2;
|
||||
if( r > 75 ) {
|
||||
r = 75;
|
||||
x = 75 - (75 * Math.cos(phi));
|
||||
y = 75 - (75 * Math.sin(phi));
|
||||
}
|
||||
x = Math.round(x);
|
||||
y = Math.round(y);
|
||||
}
|
||||
|
||||
// Move the picker
|
||||
if( target.is('.minicolors-grid') ) {
|
||||
picker
|
||||
.stop(true)
|
||||
.animate({
|
||||
top: y + 'px',
|
||||
left: x + 'px'
|
||||
}, duration, settings.animationEasing, function() {
|
||||
updateFromControl(input, target);
|
||||
});
|
||||
} else {
|
||||
picker
|
||||
.stop(true)
|
||||
.animate({
|
||||
top: y + 'px'
|
||||
}, duration, settings.animationEasing, function() {
|
||||
updateFromControl(input, target);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Sets the input based on the color picker values
|
||||
function updateFromControl(input, target) {
|
||||
|
||||
function getCoords(picker, container) {
|
||||
|
||||
var left, top;
|
||||
if( !picker.length || !container ) return null;
|
||||
left = picker.offset().left;
|
||||
top = picker.offset().top;
|
||||
|
||||
return {
|
||||
x: left - container.offset().left + (picker.outerWidth() / 2),
|
||||
y: top - container.offset().top + (picker.outerHeight() / 2)
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
var hue, saturation, brightness, rgb, x, y, r, phi,
|
||||
|
||||
hex = input.val(),
|
||||
opacity = input.attr('data-opacity'),
|
||||
|
||||
// Helpful references
|
||||
minicolors = input.parent(),
|
||||
settings = input.data('minicolors-settings'),
|
||||
panel = minicolors.find('.minicolors-panel'),
|
||||
swatch = minicolors.find('.minicolors-swatch'),
|
||||
|
||||
// Panel objects
|
||||
grid = minicolors.find('.minicolors-grid'),
|
||||
slider = minicolors.find('.minicolors-slider'),
|
||||
opacitySlider = minicolors.find('.minicolors-opacity-slider'),
|
||||
|
||||
// Picker objects
|
||||
gridPicker = grid.find('[class$=-picker]'),
|
||||
sliderPicker = slider.find('[class$=-picker]'),
|
||||
opacityPicker = opacitySlider.find('[class$=-picker]'),
|
||||
|
||||
// Picker positions
|
||||
gridPos = getCoords(gridPicker, grid),
|
||||
sliderPos = getCoords(sliderPicker, slider),
|
||||
opacityPos = getCoords(opacityPicker, opacitySlider);
|
||||
|
||||
// Handle colors
|
||||
if( target.is('.minicolors-grid, .minicolors-slider') ) {
|
||||
|
||||
// Determine HSB values
|
||||
switch(settings.control) {
|
||||
|
||||
case 'wheel':
|
||||
// Calculate hue, saturation, and brightness
|
||||
x = (grid.width() / 2) - gridPos.x;
|
||||
y = (grid.height() / 2) - gridPos.y;
|
||||
r = Math.sqrt(x * x + y * y);
|
||||
phi = Math.atan2(y, x);
|
||||
if( phi < 0 ) phi += Math.PI * 2;
|
||||
if( r > 75 ) {
|
||||
r = 75;
|
||||
gridPos.x = 69 - (75 * Math.cos(phi));
|
||||
gridPos.y = 69 - (75 * Math.sin(phi));
|
||||
}
|
||||
saturation = keepWithin(r / 0.75, 0, 100);
|
||||
hue = keepWithin(phi * 180 / Math.PI, 0, 360);
|
||||
brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
|
||||
hex = hsb2hex({
|
||||
h: hue,
|
||||
s: saturation,
|
||||
b: brightness
|
||||
});
|
||||
|
||||
// Update UI
|
||||
slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
|
||||
break;
|
||||
|
||||
case 'saturation':
|
||||
// Calculate hue, saturation, and brightness
|
||||
hue = keepWithin(parseInt(gridPos.x * (360 / grid.width())), 0, 360);
|
||||
saturation = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
|
||||
brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
|
||||
hex = hsb2hex({
|
||||
h: hue,
|
||||
s: saturation,
|
||||
b: brightness
|
||||
});
|
||||
|
||||
// Update UI
|
||||
slider.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: brightness }));
|
||||
minicolors.find('.minicolors-grid-inner').css('opacity', saturation / 100);
|
||||
break;
|
||||
|
||||
case 'brightness':
|
||||
// Calculate hue, saturation, and brightness
|
||||
hue = keepWithin(parseInt(gridPos.x * (360 / grid.width())), 0, 360);
|
||||
saturation = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
|
||||
brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
|
||||
hex = hsb2hex({
|
||||
h: hue,
|
||||
s: saturation,
|
||||
b: brightness
|
||||
});
|
||||
|
||||
// Update UI
|
||||
slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
|
||||
minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (brightness / 100));
|
||||
break;
|
||||
|
||||
default:
|
||||
// Calculate hue, saturation, and brightness
|
||||
hue = keepWithin(360 - parseInt(sliderPos.y * (360 / slider.height())), 0, 360);
|
||||
saturation = keepWithin(Math.floor(gridPos.x * (100 / grid.width())), 0, 100);
|
||||
brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
|
||||
hex = hsb2hex({
|
||||
h: hue,
|
||||
s: saturation,
|
||||
b: brightness
|
||||
});
|
||||
|
||||
// Update UI
|
||||
grid.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: 100 }));
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// Adjust case
|
||||
input.val( convertCase(hex, settings.letterCase) );
|
||||
|
||||
}
|
||||
|
||||
// Handle opacity
|
||||
if( target.is('.minicolors-opacity-slider') ) {
|
||||
if( settings.opacity ) {
|
||||
opacity = parseFloat(1 - (opacityPos.y / opacitySlider.height())).toFixed(2);
|
||||
} else {
|
||||
opacity = 1;
|
||||
}
|
||||
if( settings.opacity ) input.attr('data-opacity', opacity);
|
||||
}
|
||||
|
||||
// Set swatch color
|
||||
swatch.find('SPAN').css({
|
||||
backgroundColor: hex,
|
||||
opacity: opacity
|
||||
});
|
||||
|
||||
// Handle change event
|
||||
doChange(input, hex, opacity);
|
||||
|
||||
}
|
||||
|
||||
// Sets the color picker values from the input
|
||||
function updateFromInput(input, preserveInputValue, firstRun) {
|
||||
|
||||
var hex,
|
||||
hsb,
|
||||
opacity,
|
||||
x, y, r, phi,
|
||||
|
||||
// Helpful references
|
||||
minicolors = input.parent(),
|
||||
settings = input.data('minicolors-settings'),
|
||||
swatch = minicolors.find('.minicolors-swatch'),
|
||||
|
||||
// Panel objects
|
||||
grid = minicolors.find('.minicolors-grid'),
|
||||
slider = minicolors.find('.minicolors-slider'),
|
||||
opacitySlider = minicolors.find('.minicolors-opacity-slider'),
|
||||
|
||||
// Picker objects
|
||||
gridPicker = grid.find('[class$=-picker]'),
|
||||
sliderPicker = slider.find('[class$=-picker]'),
|
||||
opacityPicker = opacitySlider.find('[class$=-picker]');
|
||||
|
||||
// Determine hex/HSB values
|
||||
hex = convertCase(parseHex(input.val(), true), settings.letterCase);
|
||||
if( !hex ) hex = convertCase(parseHex(settings.defaultValue, true));
|
||||
hsb = hex2hsb(hex);
|
||||
|
||||
// Update input value
|
||||
if( !preserveInputValue ) input.val(hex);
|
||||
|
||||
// Determine opacity value
|
||||
if( settings.opacity ) {
|
||||
// Get from data-opacity attribute and keep within 0-1 range
|
||||
opacity = input.attr('data-opacity') === '' ? 1 : keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2), 0, 1);
|
||||
if( isNaN(opacity) ) opacity = 1;
|
||||
input.attr('data-opacity', opacity);
|
||||
swatch.find('SPAN').css('opacity', opacity);
|
||||
|
||||
// Set opacity picker position
|
||||
y = keepWithin(opacitySlider.height() - (opacitySlider.height() * opacity), 0, opacitySlider.height());
|
||||
opacityPicker.css('top', y + 'px');
|
||||
}
|
||||
|
||||
// Update swatch
|
||||
swatch.find('SPAN').css('backgroundColor', hex);
|
||||
|
||||
// Determine picker locations
|
||||
switch(settings.control) {
|
||||
|
||||
case 'wheel':
|
||||
// Set grid position
|
||||
r = keepWithin(Math.ceil(hsb.s * 0.75), 0, grid.height() / 2);
|
||||
phi = hsb.h * Math.PI / 180;
|
||||
x = keepWithin(75 - Math.cos(phi) * r, 0, grid.width());
|
||||
y = keepWithin(75 - Math.sin(phi) * r, 0, grid.height());
|
||||
gridPicker.css({
|
||||
top: y + 'px',
|
||||
left: x + 'px'
|
||||
});
|
||||
|
||||
// Set slider position
|
||||
y = 150 - (hsb.b / (100 / grid.height()));
|
||||
if( hex === '' ) y = 0;
|
||||
sliderPicker.css('top', y + 'px');
|
||||
|
||||
// Update panel color
|
||||
slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
|
||||
break;
|
||||
|
||||
case 'saturation':
|
||||
// Set grid position
|
||||
x = keepWithin((5 * hsb.h) / 12, 0, 150);
|
||||
y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
|
||||
gridPicker.css({
|
||||
top: y + 'px',
|
||||
left: x + 'px'
|
||||
});
|
||||
|
||||
// Set slider position
|
||||
y = keepWithin(slider.height() - (hsb.s * (slider.height() / 100)), 0, slider.height());
|
||||
sliderPicker.css('top', y + 'px');
|
||||
|
||||
// Update UI
|
||||
slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: hsb.b }));
|
||||
minicolors.find('.minicolors-grid-inner').css('opacity', hsb.s / 100);
|
||||
|
||||
break;
|
||||
|
||||
case 'brightness':
|
||||
// Set grid position
|
||||
x = keepWithin((5 * hsb.h) / 12, 0, 150);
|
||||
y = keepWithin(grid.height() - Math.ceil(hsb.s / (100 / grid.height())), 0, grid.height());
|
||||
gridPicker.css({
|
||||
top: y + 'px',
|
||||
left: x + 'px'
|
||||
});
|
||||
|
||||
// Set slider position
|
||||
y = keepWithin(slider.height() - (hsb.b * (slider.height() / 100)), 0, slider.height());
|
||||
sliderPicker.css('top', y + 'px');
|
||||
|
||||
// Update UI
|
||||
slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
|
||||
minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (hsb.b / 100));
|
||||
break;
|
||||
|
||||
default:
|
||||
// Set grid position
|
||||
x = keepWithin(Math.ceil(hsb.s / (100 / grid.width())), 0, grid.width());
|
||||
y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
|
||||
gridPicker.css({
|
||||
top: y + 'px',
|
||||
left: x + 'px'
|
||||
});
|
||||
|
||||
// Set slider position
|
||||
y = keepWithin(slider.height() - (hsb.h / (360 / slider.height())), 0, slider.height());
|
||||
sliderPicker.css('top', y + 'px');
|
||||
|
||||
// Update panel color
|
||||
grid.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: 100 }));
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// Handle change event
|
||||
if( !firstRun ) doChange(input, hex, opacity);
|
||||
|
||||
}
|
||||
|
||||
// Runs the change and changeDelay callbacks
|
||||
function doChange(input, hex, opacity) {
|
||||
|
||||
var settings = input.data('minicolors-settings');
|
||||
|
||||
// Only run if it actually changed
|
||||
if( hex + opacity !== input.data('minicolors-lastChange') ) {
|
||||
|
||||
// Remember last-changed value
|
||||
input.data('minicolors-lastChange', hex + opacity);
|
||||
|
||||
// Fire change event
|
||||
if( settings.change ) {
|
||||
if( settings.changeDelay ) {
|
||||
// Call after a delay
|
||||
clearTimeout(input.data('minicolors-changeTimeout'));
|
||||
input.data('minicolors-changeTimeout', setTimeout( function() {
|
||||
settings.change.call(input, hex, opacity);
|
||||
}, settings.changeDelay));
|
||||
} else {
|
||||
// Call immediately
|
||||
settings.change.call(input, hex, opacity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Generates an RGB(A) object based on the input's value
|
||||
function rgbObject(input) {
|
||||
var hex = parseHex($(input).val(), true),
|
||||
rgb = hex2rgb(hex),
|
||||
opacity = $(input).attr('data-opacity');
|
||||
if( !rgb ) return null;
|
||||
if( opacity !== undefined ) $.extend(rgb, { a: parseFloat(opacity) });
|
||||
return rgb;
|
||||
}
|
||||
|
||||
// Genearates an RGB(A) string based on the input's value
|
||||
function rgbString(input, alpha) {
|
||||
var hex = parseHex($(input).val(), true),
|
||||
rgb = hex2rgb(hex),
|
||||
opacity = $(input).attr('data-opacity');
|
||||
if( !rgb ) return null;
|
||||
if( opacity === undefined ) opacity = 1;
|
||||
if( alpha ) {
|
||||
return 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
|
||||
} else {
|
||||
return 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
|
||||
}
|
||||
}
|
||||
|
||||
// Converts to the letter case specified in settings
|
||||
function convertCase(string, letterCase) {
|
||||
return letterCase === 'uppercase' ? string.toUpperCase() : string.toLowerCase();
|
||||
}
|
||||
|
||||
// Parses a string and returns a valid hex string when possible
|
||||
function parseHex(string, expand) {
|
||||
string = string.replace(/[^A-F0-9]/ig, '');
|
||||
if( string.length !== 3 && string.length !== 6 ) return '';
|
||||
if( string.length === 3 && expand ) {
|
||||
string = string[0] + string[0] + string[1] + string[1] + string[2] + string[2];
|
||||
}
|
||||
return '#' + string;
|
||||
}
|
||||
|
||||
// Keeps value within min and max
|
||||
function keepWithin(value, min, max) {
|
||||
if( value < min ) value = min;
|
||||
if( value > max ) value = max;
|
||||
return value;
|
||||
}
|
||||
|
||||
// Converts an HSB object to an RGB object
|
||||
function hsb2rgb(hsb) {
|
||||
var rgb = {};
|
||||
var h = Math.round(hsb.h);
|
||||
var s = Math.round(hsb.s * 255 / 100);
|
||||
var v = Math.round(hsb.b * 255 / 100);
|
||||
if(s === 0) {
|
||||
rgb.r = rgb.g = rgb.b = v;
|
||||
} else {
|
||||
var t1 = v;
|
||||
var t2 = (255 - s) * v / 255;
|
||||
var t3 = (t1 - t2) * (h % 60) / 60;
|
||||
if( h === 360 ) h = 0;
|
||||
if( h < 60 ) { rgb.r = t1; rgb.b = t2; rgb.g = t2 + t3; }
|
||||
else if( h < 120 ) {rgb.g = t1; rgb.b = t2; rgb.r = t1 - t3; }
|
||||
else if( h < 180 ) {rgb.g = t1; rgb.r = t2; rgb.b = t2 + t3; }
|
||||
else if( h < 240 ) {rgb.b = t1; rgb.r = t2; rgb.g = t1 - t3; }
|
||||
else if( h < 300 ) {rgb.b = t1; rgb.g = t2; rgb.r = t2 + t3; }
|
||||
else if( h < 360 ) {rgb.r = t1; rgb.g = t2; rgb.b = t1 - t3; }
|
||||
else { rgb.r = 0; rgb.g = 0; rgb.b = 0; }
|
||||
}
|
||||
return {
|
||||
r: Math.round(rgb.r),
|
||||
g: Math.round(rgb.g),
|
||||
b: Math.round(rgb.b)
|
||||
};
|
||||
}
|
||||
|
||||
// Converts an RGB object to a hex string
|
||||
function rgb2hex(rgb) {
|
||||
var hex = [
|
||||
rgb.r.toString(16),
|
||||
rgb.g.toString(16),
|
||||
rgb.b.toString(16)
|
||||
];
|
||||
$.each(hex, function(nr, val) {
|
||||
if (val.length === 1) hex[nr] = '0' + val;
|
||||
});
|
||||
return '#' + hex.join('');
|
||||
}
|
||||
|
||||
// Converts an HSB object to a hex string
|
||||
function hsb2hex(hsb) {
|
||||
return rgb2hex(hsb2rgb(hsb));
|
||||
}
|
||||
|
||||
// Converts a hex string to an HSB object
|
||||
function hex2hsb(hex) {
|
||||
var hsb = rgb2hsb(hex2rgb(hex));
|
||||
if( hsb.s === 0 ) hsb.h = 360;
|
||||
return hsb;
|
||||
}
|
||||
|
||||
// Converts an RGB object to an HSB object
|
||||
function rgb2hsb(rgb) {
|
||||
var hsb = { h: 0, s: 0, b: 0 };
|
||||
var min = Math.min(rgb.r, rgb.g, rgb.b);
|
||||
var max = Math.max(rgb.r, rgb.g, rgb.b);
|
||||
var delta = max - min;
|
||||
hsb.b = max;
|
||||
hsb.s = max !== 0 ? 255 * delta / max : 0;
|
||||
if( hsb.s !== 0 ) {
|
||||
if( rgb.r === max ) {
|
||||
hsb.h = (rgb.g - rgb.b) / delta;
|
||||
} else if( rgb.g === max ) {
|
||||
hsb.h = 2 + (rgb.b - rgb.r) / delta;
|
||||
} else {
|
||||
hsb.h = 4 + (rgb.r - rgb.g) / delta;
|
||||
}
|
||||
} else {
|
||||
hsb.h = -1;
|
||||
}
|
||||
hsb.h *= 60;
|
||||
if( hsb.h < 0 ) {
|
||||
hsb.h += 360;
|
||||
}
|
||||
hsb.s *= 100/255;
|
||||
hsb.b *= 100/255;
|
||||
return hsb;
|
||||
}
|
||||
|
||||
// Converts a hex string to an RGB object
|
||||
function hex2rgb(hex) {
|
||||
hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
|
||||
return {
|
||||
r: hex >> 16,
|
||||
g: (hex & 0x00FF00) >> 8,
|
||||
b: (hex & 0x0000FF)
|
||||
};
|
||||
}
|
||||
|
||||
// Handle events
|
||||
$(document)
|
||||
// Hide on clicks outside of the control
|
||||
.on('mousedown.minicolors touchstart.minicolors', function(event) {
|
||||
if( !$(event.target).parents().add(event.target).hasClass('minicolors') ) {
|
||||
hide();
|
||||
}
|
||||
})
|
||||
// Start moving
|
||||
.on('mousedown.minicolors touchstart.minicolors', '.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider', function(event) {
|
||||
var target = $(this);
|
||||
event.preventDefault();
|
||||
$(document).data('minicolors-target', target);
|
||||
move(target, event, true);
|
||||
})
|
||||
// Move pickers
|
||||
.on('mousemove.minicolors touchmove.minicolors', function(event) {
|
||||
var target = $(document).data('minicolors-target');
|
||||
if( target ) move(target, event);
|
||||
})
|
||||
// Stop moving
|
||||
.on('mouseup.minicolors touchend.minicolors', function() {
|
||||
$(this).removeData('minicolors-target');
|
||||
})
|
||||
// Toggle panel when swatch is clicked
|
||||
.on('mousedown.minicolors touchstart.minicolors', '.minicolors-swatch', function(event) {
|
||||
var input = $(this).parent().find('.minicolors-input'),
|
||||
minicolors = input.parent();
|
||||
if( minicolors.hasClass('minicolors-focus') ) {
|
||||
hide(input);
|
||||
} else {
|
||||
show(input);
|
||||
}
|
||||
})
|
||||
// Show on focus
|
||||
.on('focus.minicolors', '.minicolors-input', function(event) {
|
||||
var input = $(this);
|
||||
if( !input.data('minicolors-initialized') ) return;
|
||||
show(input);
|
||||
})
|
||||
// Fix hex on blur
|
||||
.on('blur.minicolors', '.minicolors-input', function(event) {
|
||||
var input = $(this),
|
||||
settings = input.data('minicolors-settings');
|
||||
if( !input.data('minicolors-initialized') ) return;
|
||||
|
||||
// Parse Hex
|
||||
input.val(parseHex(input.val(), true));
|
||||
|
||||
// Is it blank?
|
||||
if( input.val() === '' ) input.val(parseHex(settings.defaultValue, true));
|
||||
|
||||
// Adjust case
|
||||
input.val( convertCase(input.val(), settings.letterCase) );
|
||||
|
||||
})
|
||||
// Handle keypresses
|
||||
.on('keydown.minicolors', '.minicolors-input', function(event) {
|
||||
var input = $(this);
|
||||
if( !input.data('minicolors-initialized') ) return;
|
||||
switch(event.keyCode) {
|
||||
case 9: // tab
|
||||
hide();
|
||||
break;
|
||||
case 27: // esc
|
||||
hide();
|
||||
input.blur();
|
||||
break;
|
||||
}
|
||||
})
|
||||
// Update on keyup
|
||||
.on('keyup.minicolors', '.minicolors-input', function(event) {
|
||||
var input = $(this);
|
||||
if( !input.data('minicolors-initialized') ) return;
|
||||
updateFromInput(input, true);
|
||||
})
|
||||
// Update on paste
|
||||
.on('paste.minicolors', '.minicolors-input', function(event) {
|
||||
var input = $(this);
|
||||
if( !input.data('minicolors-initialized') ) return;
|
||||
setTimeout( function() {
|
||||
updateFromInput(input, true);
|
||||
}, 1);
|
||||
});
|
||||
|
||||
})(jQuery);
|
49
media/jui/js/jquery.minicolors.min.js
vendored
Normal file
49
media/jui/js/jquery.minicolors.min.js
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
if(jQuery)(function($){$.minicolors={defaultSettings:{animationSpeed:100,animationEasing:'swing',change:null,changeDelay:0,control:'hue',defaultValue:'',hide:null,hideSpeed:100,inline:false,letterCase:'lowercase',opacity:false,position:'default',show:null,showSpeed:100,swatchPosition:'left',textfield:true,theme:'default'}};$.extend($.fn,{minicolors:function(method,data){switch(method){case'destroy':$(this).each(function(){destroy($(this));});return $(this);case'hide':hide();return $(this);case'opacity':if(data===undefined){return $(this).attr('data-opacity');}else{$(this).each(function(){refresh($(this).attr('data-opacity',data));});return $(this);}
|
||||
case'rgbObject':return rgbObject($(this),method==='rgbaObject');case'rgbString':case'rgbaString':return rgbString($(this),method==='rgbaString')
|
||||
case'settings':if(data===undefined){return $(this).data('minicolors-settings');}else{$(this).each(function(){var settings=$(this).data('minicolors-settings')||{};destroy($(this));$(this).minicolors($.extend(true,settings,data));});return $(this);}
|
||||
case'show':show($(this).eq(0));return $(this);case'value':if(data===undefined){return $(this).val();}else{$(this).each(function(){refresh($(this).val(data));});return $(this);}
|
||||
case'create':default:if(method!=='create')data=method;$(this).each(function(){init($(this),data);});return $(this);}}});function init(input,settings){var minicolors=$('<span class="minicolors" />'),defaultSettings=$.minicolors.defaultSettings;if(input.data('minicolors-initialized'))return;settings=$.extend(true,{},defaultSettings,settings);minicolors.addClass('minicolors-theme-'+settings.theme).addClass('minicolors-swatch-position-'+settings.swatchPosition).toggleClass('minicolors-swatch-left',settings.swatchPosition==='left').toggleClass('minicolors-with-opacity',settings.opacity);if(settings.position!==undefined){$.each(settings.position.split(' '),function(){minicolors.addClass('minicolors-position-'+this);});}
|
||||
input.addClass('minicolors-input').data('minicolors-initialized',true).data('minicolors-settings',settings).prop('size',7).prop('maxlength',7).wrap(minicolors).after('<span class="minicolors-panel minicolors-slider-'+settings.control+'">'+'<span class="minicolors-slider">'+'<span class="minicolors-picker"></span>'+'</span>'+'<span class="minicolors-opacity-slider">'+'<span class="minicolors-picker"></span>'+'</span>'+'<span class="minicolors-grid">'+'<span class="minicolors-grid-inner"></span>'+'<span class="minicolors-picker"><span></span></span>'+'</span>'+'</span>');input.parent().find('.minicolors-panel').on('selectstart',function(){return false;}).end();if(settings.swatchPosition==='left'){input.before('<span class="minicolors-swatch"><span></span></span>');}else{input.after('<span class="minicolors-swatch"><span></span></span>');}
|
||||
if(!settings.textfield)input.addClass('minicolors-hidden');if(settings.inline)input.parent().addClass('minicolors-inline');updateFromInput(input,false,true);}
|
||||
function destroy(input){var minicolors=input.parent();input.removeData('minicolors-initialized').removeData('minicolors-settings').removeProp('size').removeProp('maxlength').removeClass('minicolors-input');minicolors.before(input).remove();}
|
||||
function refresh(input){updateFromInput(input);}
|
||||
function show(input){var minicolors=input.parent(),panel=minicolors.find('.minicolors-panel'),settings=input.data('minicolors-settings');if(!input.data('minicolors-initialized')||input.prop('disabled')||minicolors.hasClass('minicolors-inline')||minicolors.hasClass('minicolors-focus'))return;hide();minicolors.addClass('minicolors-focus');panel.stop(true,true).fadeIn(settings.showSpeed,function(){if(settings.show)settings.show.call(input);});}
|
||||
function hide(){$('.minicolors-input').each(function(){var input=$(this),settings=input.data('minicolors-settings'),minicolors=input.parent();if(settings.inline)return;minicolors.find('.minicolors-panel').fadeOut(settings.hideSpeed,function(){if(minicolors.hasClass('minicolors-focus')){if(settings.hide)settings.hide.call(input);}
|
||||
minicolors.removeClass('minicolors-focus');});});}
|
||||
function move(target,event,animate){var input=target.parents('.minicolors').find('.minicolors-input'),settings=input.data('minicolors-settings'),picker=target.find('[class$=-picker]'),offsetX=target.offset().left,offsetY=target.offset().top,x=Math.round(event.pageX-offsetX),y=Math.round(event.pageY-offsetY),duration=animate?settings.animationSpeed:0,wx,wy,r,phi;if(event.originalEvent.changedTouches){x=event.originalEvent.changedTouches[0].pageX-offsetX;y=event.originalEvent.changedTouches[0].pageY-offsetY;}
|
||||
if(x<0)x=0;if(y<0)y=0;if(x>target.width())x=target.width();if(y>target.height())y=target.height();if(target.parent().is('.minicolors-slider-wheel')&&picker.parent().is('.minicolors-grid')){wx=75-x;wy=75-y;r=Math.sqrt(wx*wx+wy*wy);phi=Math.atan2(wy,wx);if(phi<0)phi+=Math.PI*2;if(r>75){r=75;x=75-(75*Math.cos(phi));y=75-(75*Math.sin(phi));}
|
||||
x=Math.round(x);y=Math.round(y);}
|
||||
if(target.is('.minicolors-grid')){picker.stop(true).animate({top:y+'px',left:x+'px'},duration,settings.animationEasing,function(){updateFromControl(input,target);});}else{picker.stop(true).animate({top:y+'px'},duration,settings.animationEasing,function(){updateFromControl(input,target);});}}
|
||||
function updateFromControl(input,target){function getCoords(picker,container){var left,top;if(!picker.length||!container)return null;left=picker.offset().left;top=picker.offset().top;return{x:left-container.offset().left+(picker.outerWidth()/2),y:top-container.offset().top+(picker.outerHeight()/2)};}
|
||||
var hue,saturation,brightness,rgb,x,y,r,phi,hex=input.val(),opacity=input.attr('data-opacity'),minicolors=input.parent(),settings=input.data('minicolors-settings'),panel=minicolors.find('.minicolors-panel'),swatch=minicolors.find('.minicolors-swatch'),grid=minicolors.find('.minicolors-grid'),slider=minicolors.find('.minicolors-slider'),opacitySlider=minicolors.find('.minicolors-opacity-slider'),gridPicker=grid.find('[class$=-picker]'),sliderPicker=slider.find('[class$=-picker]'),opacityPicker=opacitySlider.find('[class$=-picker]'),gridPos=getCoords(gridPicker,grid),sliderPos=getCoords(sliderPicker,slider),opacityPos=getCoords(opacityPicker,opacitySlider);if(target.is('.minicolors-grid, .minicolors-slider')){switch(settings.control){case'wheel':x=(grid.width()/2)-gridPos.x;y=(grid.height()/2)-gridPos.y;r=Math.sqrt(x*x+y*y);phi=Math.atan2(y,x);if(phi<0)phi+=Math.PI*2;if(r>75){r=75;gridPos.x=69-(75*Math.cos(phi));gridPos.y=69-(75*Math.sin(phi));}
|
||||
saturation=keepWithin(r/0.75,0,100);hue=keepWithin(phi*180/Math.PI,0,360);brightness=keepWithin(100-Math.floor(sliderPos.y*(100/slider.height())),0,100);hex=hsb2hex({h:hue,s:saturation,b:brightness});slider.css('backgroundColor',hsb2hex({h:hue,s:saturation,b:100}));break;case'saturation':hue=keepWithin(parseInt(gridPos.x*(360/grid.width())),0,360);saturation=keepWithin(100-Math.floor(sliderPos.y*(100/slider.height())),0,100);brightness=keepWithin(100-Math.floor(gridPos.y*(100/grid.height())),0,100);hex=hsb2hex({h:hue,s:saturation,b:brightness});slider.css('backgroundColor',hsb2hex({h:hue,s:100,b:brightness}));minicolors.find('.minicolors-grid-inner').css('opacity',saturation/100);break;case'brightness':hue=keepWithin(parseInt(gridPos.x*(360/grid.width())),0,360);saturation=keepWithin(100-Math.floor(gridPos.y*(100/grid.height())),0,100);brightness=keepWithin(100-Math.floor(sliderPos.y*(100/slider.height())),0,100);hex=hsb2hex({h:hue,s:saturation,b:brightness});slider.css('backgroundColor',hsb2hex({h:hue,s:saturation,b:100}));minicolors.find('.minicolors-grid-inner').css('opacity',1-(brightness/100));break;default:hue=keepWithin(360-parseInt(sliderPos.y*(360/slider.height())),0,360);saturation=keepWithin(Math.floor(gridPos.x*(100/grid.width())),0,100);brightness=keepWithin(100-Math.floor(gridPos.y*(100/grid.height())),0,100);hex=hsb2hex({h:hue,s:saturation,b:brightness});grid.css('backgroundColor',hsb2hex({h:hue,s:100,b:100}));break;}
|
||||
input.val(convertCase(hex,settings.letterCase));}
|
||||
if(target.is('.minicolors-opacity-slider')){if(settings.opacity){opacity=parseFloat(1-(opacityPos.y/opacitySlider.height())).toFixed(2);}else{opacity=1;}
|
||||
if(settings.opacity)input.attr('data-opacity',opacity);}
|
||||
swatch.find('SPAN').css({backgroundColor:hex,opacity:opacity});doChange(input,hex,opacity);}
|
||||
function updateFromInput(input,preserveInputValue,firstRun){var hex,hsb,opacity,x,y,r,phi,minicolors=input.parent(),settings=input.data('minicolors-settings'),swatch=minicolors.find('.minicolors-swatch'),grid=minicolors.find('.minicolors-grid'),slider=minicolors.find('.minicolors-slider'),opacitySlider=minicolors.find('.minicolors-opacity-slider'),gridPicker=grid.find('[class$=-picker]'),sliderPicker=slider.find('[class$=-picker]'),opacityPicker=opacitySlider.find('[class$=-picker]');hex=convertCase(parseHex(input.val(),true),settings.letterCase);if(!hex)hex=convertCase(parseHex(settings.defaultValue,true));hsb=hex2hsb(hex);if(!preserveInputValue)input.val(hex);if(settings.opacity){opacity=input.attr('data-opacity')===''?1:keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2),0,1);if(isNaN(opacity))opacity=1;input.attr('data-opacity',opacity);swatch.find('SPAN').css('opacity',opacity);y=keepWithin(opacitySlider.height()-(opacitySlider.height()*opacity),0,opacitySlider.height());opacityPicker.css('top',y+'px');}
|
||||
swatch.find('SPAN').css('backgroundColor',hex);switch(settings.control){case'wheel':r=keepWithin(Math.ceil(hsb.s*0.75),0,grid.height()/2);phi=hsb.h*Math.PI/180;x=keepWithin(75-Math.cos(phi)*r,0,grid.width());y=keepWithin(75-Math.sin(phi)*r,0,grid.height());gridPicker.css({top:y+'px',left:x+'px'});y=150-(hsb.b/(100/grid.height()));if(hex==='')y=0;sliderPicker.css('top',y+'px');slider.css('backgroundColor',hsb2hex({h:hsb.h,s:hsb.s,b:100}));break;case'saturation':x=keepWithin((5*hsb.h)/12,0,150);y=keepWithin(grid.height()-Math.ceil(hsb.b/(100/grid.height())),0,grid.height());gridPicker.css({top:y+'px',left:x+'px'});y=keepWithin(slider.height()-(hsb.s*(slider.height()/100)),0,slider.height());sliderPicker.css('top',y+'px');slider.css('backgroundColor',hsb2hex({h:hsb.h,s:100,b:hsb.b}));minicolors.find('.minicolors-grid-inner').css('opacity',hsb.s/100);break;case'brightness':x=keepWithin((5*hsb.h)/12,0,150);y=keepWithin(grid.height()-Math.ceil(hsb.s/(100/grid.height())),0,grid.height());gridPicker.css({top:y+'px',left:x+'px'});y=keepWithin(slider.height()-(hsb.b*(slider.height()/100)),0,slider.height());sliderPicker.css('top',y+'px');slider.css('backgroundColor',hsb2hex({h:hsb.h,s:hsb.s,b:100}));minicolors.find('.minicolors-grid-inner').css('opacity',1-(hsb.b/100));break;default:x=keepWithin(Math.ceil(hsb.s/(100/grid.width())),0,grid.width());y=keepWithin(grid.height()-Math.ceil(hsb.b/(100/grid.height())),0,grid.height());gridPicker.css({top:y+'px',left:x+'px'});y=keepWithin(slider.height()-(hsb.h/(360/slider.height())),0,slider.height());sliderPicker.css('top',y+'px');grid.css('backgroundColor',hsb2hex({h:hsb.h,s:100,b:100}));break;}
|
||||
if(!firstRun)doChange(input,hex,opacity);}
|
||||
function doChange(input,hex,opacity){var settings=input.data('minicolors-settings');if(hex+opacity!==input.data('minicolors-lastChange')){input.data('minicolors-lastChange',hex+opacity);if(settings.change){if(settings.changeDelay){clearTimeout(input.data('minicolors-changeTimeout'));input.data('minicolors-changeTimeout',setTimeout(function(){settings.change.call(input,hex,opacity);},settings.changeDelay));}else{settings.change.call(input,hex,opacity);}}}}
|
||||
function rgbObject(input){var hex=parseHex($(input).val(),true),rgb=hex2rgb(hex),opacity=$(input).attr('data-opacity');if(!rgb)return null;if(opacity!==undefined)$.extend(rgb,{a:parseFloat(opacity)});return rgb;}
|
||||
function rgbString(input,alpha){var hex=parseHex($(input).val(),true),rgb=hex2rgb(hex),opacity=$(input).attr('data-opacity');if(!rgb)return null;if(opacity===undefined)opacity=1;if(alpha){return'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+parseFloat(opacity)+')';}else{return'rgb('+rgb.r+', '+rgb.g+', '+rgb.b+')';}}
|
||||
function convertCase(string,letterCase){return letterCase==='uppercase'?string.toUpperCase():string.toLowerCase();}
|
||||
function parseHex(string,expand){string=string.replace(/[^A-F0-9]/ig,'');if(string.length!==3&&string.length!==6)return'';if(string.length===3&&expand){string=string[0]+string[0]+string[1]+string[1]+string[2]+string[2];}
|
||||
return'#'+string;}
|
||||
function keepWithin(value,min,max){if(value<min)value=min;if(value>max)value=max;return value;}
|
||||
function hsb2rgb(hsb){var rgb={};var h=Math.round(hsb.h);var s=Math.round(hsb.s*255/100);var v=Math.round(hsb.b*255/100);if(s===0){rgb.r=rgb.g=rgb.b=v;}else{var t1=v;var t2=(255-s)*v/255;var t3=(t1-t2)*(h%60)/60;if(h===360)h=0;if(h<60){rgb.r=t1;rgb.b=t2;rgb.g=t2+t3;}
|
||||
else if(h<120){rgb.g=t1;rgb.b=t2;rgb.r=t1-t3;}
|
||||
else if(h<180){rgb.g=t1;rgb.r=t2;rgb.b=t2+t3;}
|
||||
else if(h<240){rgb.b=t1;rgb.r=t2;rgb.g=t1-t3;}
|
||||
else if(h<300){rgb.b=t1;rgb.g=t2;rgb.r=t2+t3;}
|
||||
else if(h<360){rgb.r=t1;rgb.g=t2;rgb.b=t1-t3;}
|
||||
else{rgb.r=0;rgb.g=0;rgb.b=0;}}
|
||||
return{r:Math.round(rgb.r),g:Math.round(rgb.g),b:Math.round(rgb.b)};}
|
||||
function rgb2hex(rgb){var hex=[rgb.r.toString(16),rgb.g.toString(16),rgb.b.toString(16)];$.each(hex,function(nr,val){if(val.length===1)hex[nr]='0'+val;});return'#'+hex.join('');}
|
||||
function hsb2hex(hsb){return rgb2hex(hsb2rgb(hsb));}
|
||||
function hex2hsb(hex){var hsb=rgb2hsb(hex2rgb(hex));if(hsb.s===0)hsb.h=360;return hsb;}
|
||||
function rgb2hsb(rgb){var hsb={h:0,s:0,b:0};var min=Math.min(rgb.r,rgb.g,rgb.b);var max=Math.max(rgb.r,rgb.g,rgb.b);var delta=max-min;hsb.b=max;hsb.s=max!==0?255*delta/max:0;if(hsb.s!==0){if(rgb.r===max){hsb.h=(rgb.g-rgb.b)/delta;}else if(rgb.g===max){hsb.h=2+(rgb.b-rgb.r)/delta;}else{hsb.h=4+(rgb.r-rgb.g)/delta;}}else{hsb.h=-1;}
|
||||
hsb.h*=60;if(hsb.h<0){hsb.h+=360;}
|
||||
hsb.s*=100/255;hsb.b*=100/255;return hsb;}
|
||||
function hex2rgb(hex){hex=parseInt(((hex.indexOf('#')>-1)?hex.substring(1):hex),16);return{r:hex>>16,g:(hex&0x00FF00)>>8,b:(hex&0x0000FF)};}
|
||||
$(document).on('mousedown.minicolors touchstart.minicolors',function(event){if(!$(event.target).parents().add(event.target).hasClass('minicolors')){hide();}}).on('mousedown.minicolors touchstart.minicolors','.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider',function(event){var target=$(this);event.preventDefault();$(document).data('minicolors-target',target);move(target,event,true);}).on('mousemove.minicolors touchmove.minicolors',function(event){var target=$(document).data('minicolors-target');if(target)move(target,event);}).on('mouseup.minicolors touchend.minicolors',function(){$(this).removeData('minicolors-target');}).on('mousedown.minicolors touchstart.minicolors','.minicolors-swatch',function(event){var input=$(this).parent().find('.minicolors-input'),minicolors=input.parent();if(minicolors.hasClass('minicolors-focus')){hide(input);}else{show(input);}}).on('focus.minicolors','.minicolors-input',function(event){var input=$(this);if(!input.data('minicolors-initialized'))return;show(input);}).on('blur.minicolors','.minicolors-input',function(event){var input=$(this),settings=input.data('minicolors-settings');if(!input.data('minicolors-initialized'))return;input.val(parseHex(input.val(),true));if(input.val()==='')input.val(parseHex(settings.defaultValue,true));input.val(convertCase(input.val(),settings.letterCase));}).on('keydown.minicolors','.minicolors-input',function(event){var input=$(this);if(!input.data('minicolors-initialized'))return;switch(event.keyCode){case 9:hide();break;case 27:hide();input.blur();break;}}).on('keyup.minicolors','.minicolors-input',function(event){var input=$(this);if(!input.data('minicolors-initialized'))return;updateFromInput(input,true);}).on('paste.minicolors','.minicolors-input',function(event){var input=$(this);if(!input.data('minicolors-initialized'))return;setTimeout(function(){updateFromInput(input,true);},1);});})(jQuery);
|
202
media/jui/js/jquery.simplecolors.js
Normal file
202
media/jui/js/jquery.simplecolors.js
Normal file
@ -0,0 +1,202 @@
|
||||
/**
|
||||
* LOOSELY BASED ON:
|
||||
* Very simple jQuery Color Picker
|
||||
* Copyright (C) 2012 Tanguy Krotoff
|
||||
* Licensed under the MIT license
|
||||
*
|
||||
* ADAPTED BY:
|
||||
* Copyright (C) 2013 Peter van Westen
|
||||
*/
|
||||
|
||||
(function($)
|
||||
{
|
||||
var SimpleColorPicker = function(element, options)
|
||||
{
|
||||
this.select = $(element);
|
||||
this.options = $.extend({}, $.fn.simplecolors.defaults, options);
|
||||
|
||||
this.select.hide();
|
||||
|
||||
// Build the list of colors
|
||||
var list = '';
|
||||
$('option', this.select).each(function()
|
||||
{
|
||||
var option = $(this);
|
||||
var color = option.val();
|
||||
if (option.text() == '-') {
|
||||
list += '<br />';
|
||||
} else {
|
||||
var clss = 'simplecolors-swatch';
|
||||
if (color == 'none') {
|
||||
clss += ' nocolor';
|
||||
color = 'transparent';
|
||||
}
|
||||
if (option.attr('selected')) {
|
||||
clss += ' active';
|
||||
}
|
||||
list += '<span class="' + clss + '"><span style="background-color: ' + color + ';" tabindex="0"></span></span>';
|
||||
}
|
||||
});
|
||||
|
||||
var color = this.select.val();
|
||||
var clss = 'simplecolors-swatch';
|
||||
if (color == 'none') {
|
||||
clss += ' nocolor';
|
||||
color = 'transparent';
|
||||
}
|
||||
this.icon = $('<span class="' + clss + '"><span style="background-color: ' + color + ';" tabindex="0"></span></span>').insertAfter(this.select);
|
||||
this.icon.on('click', $.proxy(this.show, this));
|
||||
|
||||
this.panel = $('<span class="simplecolors-panel"></span>').appendTo(document.body);
|
||||
this.panel.html(list);
|
||||
this.panel.on('click', $.proxy(this.click, this));
|
||||
|
||||
// Hide panel when clicking outside
|
||||
$(document).on('mousedown', $.proxy(this.hide, this));
|
||||
this.panel.on('mousedown', $.proxy(this.mousedown, this));
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* SimpleColorPicker class
|
||||
*/
|
||||
SimpleColorPicker.prototype = {
|
||||
constructor: SimpleColorPicker,
|
||||
|
||||
show: function()
|
||||
{
|
||||
var panelpadding = 7; // Empirical value
|
||||
var pos = this.icon.offset();
|
||||
switch (this.select.attr('data-position')) {
|
||||
case 'top':
|
||||
this.panel.css({
|
||||
left: pos.left - panelpadding,
|
||||
top: pos.top - this.panel.outerHeight() - 1
|
||||
});
|
||||
break;
|
||||
case 'bottom':
|
||||
this.panel.css({
|
||||
left: pos.left - panelpadding,
|
||||
top: pos.top + this.icon.outerHeight()
|
||||
});
|
||||
break;
|
||||
case 'left':
|
||||
this.panel.css({
|
||||
left: pos.left - this.panel.outerWidth(),
|
||||
top: pos.top - ( (this.panel.outerHeight() - this.icon.outerHeight() ) / 2 ) - 1
|
||||
});
|
||||
break;
|
||||
case 'right':
|
||||
default:
|
||||
this.panel.css({
|
||||
left: pos.left + this.icon.outerWidth(),
|
||||
top: pos.top - ( (this.panel.outerHeight() - this.icon.outerHeight() ) / 2 ) - 1
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
this.panel.show(this.options.delay);
|
||||
},
|
||||
|
||||
hide: function()
|
||||
{
|
||||
this.panel.hide(this.options.delay);
|
||||
},
|
||||
|
||||
click: function(e)
|
||||
{
|
||||
var target = $(e.target);
|
||||
if (target.length === 1) {
|
||||
if (target[0].nodeName.toLowerCase() === 'span') {
|
||||
// When you click on a color
|
||||
|
||||
var color = '';
|
||||
var bgcolor = '';
|
||||
var clss = '';
|
||||
if (target.parent().hasClass('nocolor')) {
|
||||
color = 'none';
|
||||
bgcolor = 'transparent';
|
||||
clss = 'nocolor';
|
||||
} else {
|
||||
color = this.rgb2hex(target.css('background-color'));
|
||||
bgcolor = color;
|
||||
}
|
||||
|
||||
// Mark this div as the selected one
|
||||
target.parent().siblings().removeClass('active');
|
||||
target.parent().addClass('active');
|
||||
|
||||
this.icon.removeClass('nocolor').addClass(clss);
|
||||
this.icon.find('span').css('background-color', bgcolor);
|
||||
|
||||
// Hide the panel
|
||||
this.hide();
|
||||
|
||||
// Change select value
|
||||
this.select.val(color).change();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Prevents the mousedown event from "eating" the click event.
|
||||
*/
|
||||
mousedown: function(e)
|
||||
{
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts a RGB color to its hexadecimal value.
|
||||
*
|
||||
* See http://stackoverflow.com/questions/1740700/get-hex-value-rather-than-rgb-value-using-$
|
||||
*/
|
||||
rgb2hex: function(rgb)
|
||||
{
|
||||
function hex(x)
|
||||
{
|
||||
return ("0" + parseInt(x, 10).toString(16)).slice(-2);
|
||||
}
|
||||
|
||||
var matches = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
||||
if (matches === null) {
|
||||
// Fix for Internet Explorer < 9
|
||||
// Variable rgb is already a hexadecimal value
|
||||
return rgb;
|
||||
} else {
|
||||
return '#' + hex(matches[1]) + hex(matches[2]) + hex(matches[3]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Plugin definition.
|
||||
*/
|
||||
$.fn.simplecolors = function(option)
|
||||
{
|
||||
// For HTML element passed to the plugin
|
||||
return this.each(function()
|
||||
{
|
||||
var $this = $(this),
|
||||
data = $this.data('simplecolors'),
|
||||
options = typeof option === 'object' && option;
|
||||
if (!data) {
|
||||
$this.data('simplecolors', (data = new SimpleColorPicker(this, options)));
|
||||
}
|
||||
if (typeof option === 'string') {
|
||||
data[option]();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.simplecolors.Constructor = SimpleColorPicker;
|
||||
|
||||
/**
|
||||
* Default options.
|
||||
*/
|
||||
$.fn.simplecolors.defaults = {
|
||||
// Animation delay
|
||||
delay: 0
|
||||
};
|
||||
})(jQuery);
|
19
media/jui/js/jquery.simplecolors.min.js
vendored
Normal file
19
media/jui/js/jquery.simplecolors.min.js
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
(function($)
|
||||
{var SimpleColorPicker=function(element,options)
|
||||
{this.select=$(element);this.options=$.extend({},$.fn.simplecolors.defaults,options);this.select.hide();var list='';$('option',this.select).each(function()
|
||||
{var option=$(this);var color=option.val();if(option.text()=='-'){list+='<br />';}else{var clss='simplecolors-swatch';if(color=='none'){clss+=' nocolor';color='transparent';}
|
||||
if(option.attr('selected')){clss+=' active';}
|
||||
list+='<span class="'+clss+'"><span style="background-color: '+color+';" tabindex="0"></span></span>';}});var color=this.select.val();var clss='simplecolors-swatch';if(color=='none'){clss+=' nocolor';color='transparent';}
|
||||
this.icon=$('<span class="'+clss+'"><span style="background-color: '+color+';" tabindex="0"></span></span>').insertAfter(this.select);this.icon.on('click',$.proxy(this.show,this));this.panel=$('<span class="simplecolors-panel"></span>').appendTo(document.body);this.panel.html(list);this.panel.on('click',$.proxy(this.click,this));$(document).on('mousedown',$.proxy(this.hide,this));this.panel.on('mousedown',$.proxy(this.mousedown,this));};SimpleColorPicker.prototype={constructor:SimpleColorPicker,show:function()
|
||||
{var panelpadding=7;var pos=this.icon.offset();switch(this.select.attr('data-position')){case'top':this.panel.css({left:pos.left-panelpadding,top:pos.top-this.panel.outerHeight()-1});break;case'bottom':this.panel.css({left:pos.left-panelpadding,top:pos.top+this.icon.outerHeight()});break;case'left':this.panel.css({left:pos.left-this.panel.outerWidth(),top:pos.top-((this.panel.outerHeight()-this.icon.outerHeight())/2)-1});break;case'right':default:this.panel.css({left:pos.left+this.icon.outerWidth(),top:pos.top-((this.panel.outerHeight()-this.icon.outerHeight())/2)-1});break;}
|
||||
this.panel.show(this.options.delay);},hide:function()
|
||||
{this.panel.hide(this.options.delay);},click:function(e)
|
||||
{var target=$(e.target);if(target.length===1){if(target[0].nodeName.toLowerCase()==='span'){var color='';var bgcolor='';var clss='';if(target.parent().hasClass('nocolor')){color='none';bgcolor='transparent';clss='nocolor';}else{color=this.rgb2hex(target.css('background-color'));bgcolor=color;}
|
||||
target.parent().siblings().removeClass('active');target.parent().addClass('active');this.icon.removeClass('nocolor').addClass(clss);this.icon.find('span').css('background-color',bgcolor);this.hide();this.select.val(color).change();}}},mousedown:function(e)
|
||||
{e.stopPropagation();e.preventDefault();},rgb2hex:function(rgb)
|
||||
{function hex(x)
|
||||
{return("0"+parseInt(x,10).toString(16)).slice(-2);}
|
||||
var matches=rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(matches===null){return rgb;}else{return'#'+hex(matches[1])+hex(matches[2])+hex(matches[3]);}}};$.fn.simplecolors=function(option)
|
||||
{return this.each(function()
|
||||
{var $this=$(this),data=$this.data('simplecolors'),options=typeof option==='object'&&option;if(!data){$this.data('simplecolors',(data=new SimpleColorPicker(this,options)));}
|
||||
if(typeof option==='string'){data[option]();}});};$.fn.simplecolors.Constructor=SimpleColorPicker;$.fn.simplecolors.defaults={delay:0};})(jQuery);
|
1081
media/jui/js/jquery.ui.core.js
vendored
Normal file
1081
media/jui/js/jquery.ui.core.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
17
media/jui/js/jquery.ui.core.min.js
vendored
Normal file
17
media/jui/js/jquery.ui.core.min.js
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
/*! jQuery UI - v1.8.23 - 2012-08-15
|
||||
* https://github.com/jquery/jquery-ui
|
||||
* Includes: jquery.ui.core.js
|
||||
* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
|
||||
(function(a,b){function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;return!b.href||!g||f.nodeName.toLowerCase()!=="map"?!1:(h=a("img[usemap=#"+g+"]")[0],!!h&&d(h))}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.ui=a.ui||{};if(a.ui.version)return;a.extend(a.ui,{version:"1.8.23",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;return a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a("<a>").outerWidth(1).jquery||a.each(["Width","Height"],function(c,d){function h(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)}),c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){return c===b?g["inner"+d].call(this):this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){return typeof b!="number"?g["outer"+d].call(this,b):this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:a.expr.createPseudo?a.expr.createPseudo(function(b){return function(c){return!!a.data(c,b)}}):function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.curCSS||(a.curCSS=a.css),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!d||!a.element[0].parentNode)return;for(var e=0;e<d.length;e++)a.options[d[e][0]]&&d[e][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if(a(b).css("overflow")==="hidden")return!1;var d=c&&c==="left"?"scrollLeft":"scrollTop",e=!1;return b[d]>0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,d,e,f,g){return a.ui.isOverAxis(b,d,f)&&a.ui.isOverAxis(c,e,g)}})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15
|
||||
* https://github.com/jquery/jquery-ui
|
||||
* Includes: jquery.ui.widget.js
|
||||
* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
|
||||
(function(a,b){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var d=0,e;(e=b[d])!=null;d++)try{a(e).triggerHandler("remove")}catch(f){}c(b)}}else{var d=a.fn.remove;a.fn.remove=function(b,c){return this.each(function(){return c||(!b||a.filter(b,[this]).length)&&a("*",this).add([this]).each(function(){try{a(this).triggerHandler("remove")}catch(b){}}),d.call(a(this),b,c)})}}a.widget=function(b,c,d){var e=b.split(".")[0],f;b=b.split(".")[1],f=e+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][f]=function(c){return!!a.data(c,b)},a[e]=a[e]||{},a[e][b]=function(a,b){arguments.length&&this._createWidget(a,b)};var g=new c;g.options=a.extend(!0,{},g.options),a[e][b].prototype=a.extend(!0,g,{namespace:e,widgetName:b,widgetEventPrefix:a[e][b].prototype.widgetEventPrefix||b,widgetBaseClass:f},d),a.widget.bridge(b,a[e][b])},a.widget.bridge=function(c,d){a.fn[c]=function(e){var f=typeof e=="string",g=Array.prototype.slice.call(arguments,1),h=this;return e=!f&&g.length?a.extend.apply(null,[!0,e].concat(g)):e,f&&e.charAt(0)==="_"?h:(f?this.each(function(){var d=a.data(this,c),f=d&&a.isFunction(d[e])?d[e].apply(d,g):d;if(f!==d&&f!==b)return h=f,!1}):this.each(function(){var b=a.data(this,c);b?b.option(e||{})._init():a.data(this,c,new d(e,this))}),h)}},a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)},a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(b,c){a.data(c,this.widgetName,this),this.element=a(c),this.options=a.extend(!0,{},this.options,this._getCreateOptions(),b);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()}),this._create(),this._trigger("create"),this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName),this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled")},widget:function(){return this.element},option:function(c,d){var e=c;if(arguments.length===0)return a.extend({},this.options);if(typeof c=="string"){if(d===b)return this.options[c];e={},e[c]=d}return this._setOptions(e),this},_setOptions:function(b){var c=this;return a.each(b,function(a,b){c._setOption(a,b)}),this},_setOption:function(a,b){return this.options[a]=b,a==="disabled"&&this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",b),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(b,c,d){var e,f,g=this.options[b];d=d||{},c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),c.target=this.element[0],f=c.originalEvent;if(f)for(e in f)e in c||(c[e]=f[e]);return this.element.trigger(c,d),!(a.isFunction(g)&&g.call(this.element[0],c,d)===!1||c.isDefaultPrevented())}}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15
|
||||
* https://github.com/jquery/jquery-ui
|
||||
* Includes: jquery.ui.mouse.js
|
||||
* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
|
||||
(function(a,b){var c=!1;a(document).mouseup(function(a){c=!1}),a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(a){return b._mouseDown(a)}).bind("click."+this.widgetName,function(c){if(!0===a.data(c.target,b.widgetName+".preventClickEvent"))return a.removeData(c.target,b.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(b){if(c)return;this._mouseStarted&&this._mouseUp(b),this._mouseDownEvent=b;var d=this,e=b.which==1,f=typeof this.options.cancel=="string"&&b.target.nodeName?a(b.target).closest(this.options.cancel).length:!1;if(!e||f||!this._mouseCapture(b))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=this._mouseStart(b)!==!1;if(!this._mouseStarted)return b.preventDefault(),!0}return!0===a.data(b.target,this.widgetName+".preventClickEvent")&&a.removeData(b.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(a){return d._mouseMove(a)},this._mouseUpDelegate=function(a){return d._mouseUp(a)},a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),b.preventDefault(),c=!0,!0},_mouseMove:function(b){return!a.browser.msie||document.documentMode>=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp(b)},_mouseUp:function(b){return a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15
|
||||
* https://github.com/jquery/jquery-ui
|
||||
* Includes: jquery.ui.position.js
|
||||
* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
|
||||
(function(a,b){a.ui=a.ui||{};var c=/left|center|right/,d=/top|center|bottom/,e="center",f={},g=a.fn.position,h=a.fn.offset;a.fn.position=function(b){if(!b||!b.of)return g.apply(this,arguments);b=a.extend({},b);var h=a(b.of),i=h[0],j=(b.collision||"flip").split(" "),k=b.offset?b.offset.split(" "):[0,0],l,m,n;return i.nodeType===9?(l=h.width(),m=h.height(),n={top:0,left:0}):i.setTimeout?(l=h.width(),m=h.height(),n={top:h.scrollTop(),left:h.scrollLeft()}):i.preventDefault?(b.at="left top",l=m=0,n={top:b.of.pageY,left:b.of.pageX}):(l=h.outerWidth(),m=h.outerHeight(),n=h.offset()),a.each(["my","at"],function(){var a=(b[this]||"").split(" ");a.length===1&&(a=c.test(a[0])?a.concat([e]):d.test(a[0])?[e].concat(a):[e,e]),a[0]=c.test(a[0])?a[0]:e,a[1]=d.test(a[1])?a[1]:e,b[this]=a}),j.length===1&&(j[1]=j[0]),k[0]=parseInt(k[0],10)||0,k.length===1&&(k[1]=k[0]),k[1]=parseInt(k[1],10)||0,b.at[0]==="right"?n.left+=l:b.at[0]===e&&(n.left+=l/2),b.at[1]==="bottom"?n.top+=m:b.at[1]===e&&(n.top+=m/2),n.left+=k[0],n.top+=k[1],this.each(function(){var c=a(this),d=c.outerWidth(),g=c.outerHeight(),h=parseInt(a.curCSS(this,"marginLeft",!0))||0,i=parseInt(a.curCSS(this,"marginTop",!0))||0,o=d+h+(parseInt(a.curCSS(this,"marginRight",!0))||0),p=g+i+(parseInt(a.curCSS(this,"marginBottom",!0))||0),q=a.extend({},n),r;b.my[0]==="right"?q.left-=d:b.my[0]===e&&(q.left-=d/2),b.my[1]==="bottom"?q.top-=g:b.my[1]===e&&(q.top-=g/2),f.fractions||(q.left=Math.round(q.left),q.top=Math.round(q.top)),r={left:q.left-h,top:q.top-i},a.each(["left","top"],function(c,e){a.ui.position[j[c]]&&a.ui.position[j[c]][e](q,{targetWidth:l,targetHeight:m,elemWidth:d,elemHeight:g,collisionPosition:r,collisionWidth:o,collisionHeight:p,offset:k,my:b.my,at:b.at})}),a.fn.bgiframe&&c.bgiframe(),c.offset(a.extend(q,{using:b.using}))})},a.ui.position={fit:{left:function(b,c){var d=a(window),e=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=e>0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left)},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if(c.at[0]===e)return;var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0},top:function(b,c){if(c.at[1]===e)return;var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top",!0),10)||0,g=parseInt(a.curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h)},a.fn.offset=function(b){var c=this[0];return!c||!c.ownerDocument?null:b?a.isFunction(b)?this.each(function(c){a(this).offset(b.call(this,c,a(this).offset()))}):this.each(function(){a.offset.setOffset(this,b)}):h.call(this)}),a.curCSS||(a.curCSS=a.css),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&a.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22}()})(jQuery);;
|
1084
media/jui/js/jquery.ui.sortable.js
vendored
Normal file
1084
media/jui/js/jquery.ui.sortable.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5
media/jui/js/jquery.ui.sortable.min.js
vendored
Normal file
5
media/jui/js/jquery.ui.sortable.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
276
media/jui/js/sortablelist.js
Normal file
276
media/jui/js/sortablelist.js
Normal file
@ -0,0 +1,276 @@
|
||||
/**
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
$.JSortableList = function (tableWrapper, formId, sortDir, saveOrderingUrl, options, nestedList) {
|
||||
var root = this;
|
||||
var disabledOrderingElements = '';
|
||||
var sortableGroupId = '';
|
||||
var sortableRange;
|
||||
var childrenNodes;
|
||||
var sameLevelNodes;
|
||||
if (sortDir != 'desc') {
|
||||
sortDir = 'asc';
|
||||
}
|
||||
|
||||
var ops = $.extend({
|
||||
orderingIcon:'add-on', //class name of order icon
|
||||
orderingWrapper:'input-prepend', //ordering control wrapper class name
|
||||
orderingGroup:'sortable-group-id', //sortable-group-id
|
||||
sortableClassName:'dndlist-sortable',
|
||||
placeHolderClassName:'dnd-list-highlight dndlist-place-holder',
|
||||
sortableHandle:'.sortable-handler'
|
||||
}, options);
|
||||
|
||||
$('tr', tableWrapper).removeClass(ops.sortableClassName).addClass(ops.sortableClassName);
|
||||
//make wrapper table position be relative, to fix y-axis drag problem on Safari
|
||||
$(tableWrapper).parents('table').css('position', 'relative');
|
||||
$(ops.sortableHandle, tableWrapper).css('cursor', 'move');
|
||||
$('#' + formId).attr('autocomplete', 'off');
|
||||
|
||||
var _handle = $(ops.sortableHandle, $(tableWrapper)).length > 0 ? ops.sortableHandle : '';
|
||||
|
||||
$(tableWrapper).sortable({
|
||||
axis:'y',
|
||||
cursor:'move',
|
||||
handle:_handle,
|
||||
items:'tr.' + ops.sortableClassName,
|
||||
placeholder:ops.placeHolderClassName,
|
||||
helper:function (e, ui) {
|
||||
//hard set left position to fix y-axis drag problem on Safari
|
||||
$(ui).css({'left':'0px'})
|
||||
|
||||
ui.children().each(function () {
|
||||
$(this).width($(this).width());
|
||||
});
|
||||
$(ui).children('td').addClass('dndlist-dragged-row');
|
||||
return ui;
|
||||
},
|
||||
|
||||
start:function (e, ui) {
|
||||
root.sortableGroupId = ui.item.attr(ops.orderingGroup);
|
||||
if (root.sortableGroupId) {
|
||||
root.sortableRange = $('tr[' + ops.orderingGroup + '=' + root.sortableGroupId + ']');
|
||||
} else {
|
||||
root.sortableRange = $('.' + ops.sortableClassName);
|
||||
}
|
||||
//Disable sortable for other group's records
|
||||
root.disableOtherGroupSort(e, ui);
|
||||
|
||||
//Proceed nested list
|
||||
if (nestedList){
|
||||
root.hideChidlrenNodes(ui.item.attr('item-id'));
|
||||
root.hideSameLevelChildrenNodes(ui.item.attr('level'));
|
||||
$(tableWrapper).sortable('refresh');
|
||||
}
|
||||
},
|
||||
|
||||
stop:function (e, ui) {
|
||||
$('td', $(this)).removeClass('dndlist-dragged-row');
|
||||
$(ui.item).css({opacity:0});
|
||||
$(ui.item).animate({
|
||||
opacity:1,
|
||||
}, 800, function (){
|
||||
$(ui.item).css('opacity','');
|
||||
});
|
||||
|
||||
|
||||
root.enableOtherGroupSort(e, ui);
|
||||
|
||||
root.rearrangeOrderingValues(root.sortableGroupId, ui);
|
||||
if (saveOrderingUrl) {
|
||||
//clone and check all the checkboxes in sortable range to post
|
||||
root.cloneMarkedCheckboxes();
|
||||
|
||||
//serialize form then post to callback url
|
||||
var formData = $('#' + formId).serialize();
|
||||
formData = formData.replace('task', '');
|
||||
$.post(saveOrderingUrl, formData);
|
||||
|
||||
//remove cloned checkboxes
|
||||
root.removeClonedCheckboxes();
|
||||
}
|
||||
root.disabledOrderingElements = '';
|
||||
//Proceed nested list
|
||||
if (nestedList){
|
||||
root.showChildrenNodes(ui.item);
|
||||
root.showSameLevelChildrenNodes(ui.item);
|
||||
$(tableWrapper).sortable('refresh');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.hideChidlrenNodes = function (itemId) {
|
||||
root.childrenNodes = root.getChildrenNodes(itemId);
|
||||
root.childrenNodes.hide();
|
||||
}
|
||||
|
||||
this.showChildrenNodes = function (item) {
|
||||
item.after(root.childrenNodes)
|
||||
root.childrenNodes.show();
|
||||
root.childrenNodes="";
|
||||
}
|
||||
|
||||
this.hideSameLevelChildrenNodes = function (level) {
|
||||
root.sameLevelNodes = root.getSameLevelNodes(level);
|
||||
root.sameLevelNodes.each(function (){
|
||||
_childrenNodes = root.getChildrenNodes($(this).attr('item-id'));
|
||||
_childrenNodes.addClass('child-nodes-tmp-hide');
|
||||
_childrenNodes.hide();
|
||||
});
|
||||
}
|
||||
|
||||
this.showSameLevelChildrenNodes = function (item) {
|
||||
prevItem = item.prev();
|
||||
prevItemChildrenNodes = root.getChildrenNodes(prevItem.attr('item-id'));
|
||||
prevItem.after(prevItemChildrenNodes);
|
||||
$('tr.child-nodes-tmp-hide').show().removeClass('child-nodes-tmp-hide');
|
||||
root.sameLevelNodes = "";
|
||||
}
|
||||
|
||||
|
||||
this.disableOtherGroupSort = function (e, ui) {
|
||||
if (root.sortableGroupId) {
|
||||
var _tr = $('tr[' + ops.orderingGroup + '!=' + root.sortableGroupId + ']', $(tableWrapper));
|
||||
_tr.removeClass(ops.sortableClassName).addClass('dndlist-group-disabled');
|
||||
|
||||
$(tableWrapper).sortable('refresh');
|
||||
}
|
||||
}
|
||||
|
||||
this.enableOtherGroupSort = function (e, ui) {
|
||||
var _tr = $('tr', $(tableWrapper)).removeClass(ops.sortableClassName);
|
||||
_tr.addClass(ops.sortableClassName)
|
||||
.removeClass('dndlist-group-disabled');
|
||||
$(tableWrapper).sortable('refresh');
|
||||
}
|
||||
|
||||
this.disableOrderingControl = function () {
|
||||
$('.' + ops.orderingWrapper + ' .add-on a', root.sortableRange).hide();
|
||||
}
|
||||
|
||||
this.enableOrderingControl = function () {
|
||||
$('.' + ops.orderingWrapper + ' .add-on a', root.disabledOrderingElements).show();
|
||||
}
|
||||
|
||||
this.rearrangeOrderingControl = function (sortableGroupId, ui) {
|
||||
var range;
|
||||
if (sortableGroupId) {
|
||||
root.sortableRange = $('tr[' + ops.orderingGroup + '=' + sortableGroupId + ']');
|
||||
} else {
|
||||
root.sortableRange = $('.' + ops.sortableClassName);
|
||||
}
|
||||
range = root.sortableRange;
|
||||
var count = range.length;
|
||||
var i = 0;
|
||||
if (count > 1) {
|
||||
range.each(function () {
|
||||
//firstible, add both ordering icons for missing-icon item
|
||||
var upIcon = $('.' + ops.orderingWrapper + ' .add-on:first a', $(this)); //get orderup icon of current dropped item
|
||||
var downIcon = $('.' + ops.orderingWrapper + ' .add-on:last a', $(this)); //get orderup icon of current dropped item
|
||||
if (upIcon.get(0) && downIcon.get(0)) {
|
||||
//do nothing
|
||||
} else if (upIcon.get(0)) {
|
||||
upIcon.removeAttr('title');
|
||||
upIcon = $('.' + ops.orderingWrapper + ' .add-on:first', $(this)).html();
|
||||
downIcon = upIcon.replace('icon-uparrow', 'icon-downarrow');
|
||||
downIcon = downIcon.replace('.orderup', '.orderdown');
|
||||
$('.' + ops.orderingWrapper + ' .add-on:last', $(this)).html(downIcon);
|
||||
} else if (downIcon.get(0)) {
|
||||
downIcon.removeAttr('title');
|
||||
downIcon = $('.' + ops.orderingWrapper + ' .add-on:last', $(this)).html();
|
||||
upIcon = downIcon.replace('icon-downarrow', 'icon-uparrow');
|
||||
upIcon = upIcon.replace('.orderdown', '.orderup');
|
||||
$('.' + ops.orderingWrapper + ' .add-on:first', $(this)).html(upIcon);
|
||||
}
|
||||
});
|
||||
|
||||
//remove orderup icon for first record
|
||||
$('.' + ops.orderingWrapper + ' .add-on:first a', range[0]).remove();
|
||||
//remove order down icon for last record
|
||||
$('.' + ops.orderingWrapper + ' .add-on:last a', range[(count - 1)]).remove();
|
||||
}
|
||||
}
|
||||
|
||||
this.rearrangeOrderingValues = function (sortableGroupId, ui) {
|
||||
var range;
|
||||
if (sortableGroupId) {
|
||||
root.sortableRange = $('tr[' + ops.orderingGroup + '=' + sortableGroupId + ']');
|
||||
} else {
|
||||
root.sortableRange = $('.' + ops.sortableClassName);
|
||||
}
|
||||
range = root.sortableRange;
|
||||
var count = range.length;
|
||||
var i = 0;
|
||||
|
||||
if (count > 1) {
|
||||
//recalculate order number
|
||||
if (ui.originalPosition.top > ui.position.top) //if item moved up
|
||||
{
|
||||
if (ui.item.position().top != ui.originalPosition.top){
|
||||
$('[type=text]', ui.item).attr('value', parseInt($('[type=text]', ui.item.next()).attr('value')));
|
||||
}
|
||||
$(range).each(function () {
|
||||
var _top = $(this).position().top;
|
||||
if ( ui.item.get(0) !== $(this).get(0)){
|
||||
if (_top > ui.item.position().top && _top <= ui.originalPosition.top) {
|
||||
if (sortDir == 'asc') {
|
||||
var newValue = parseInt($('[type=text]', $(this)).attr('value')) + 1;
|
||||
} else {
|
||||
var newValue = parseInt($('[type=text]', $(this)).attr('value')) - 1;
|
||||
}
|
||||
|
||||
$('[type=text]', $(this)).attr('value', newValue);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (ui.originalPosition.top < ui.position.top) {
|
||||
if (ui.item.position().top != ui.originalPosition.top){
|
||||
$('[type=text]', ui.item).attr('value', parseInt($('[type=text]', ui.item.prev()).attr('value')));
|
||||
}
|
||||
$(range).each(function () {
|
||||
var _top = $(this).position().top;
|
||||
if ( ui.item.get(0) !== $(this).get(0)){
|
||||
if (_top < ui.item.position().top && _top >= ui.originalPosition.top) {
|
||||
if (sortDir == 'asc') {
|
||||
var newValue = parseInt($('[type=text]', $(this)).attr('value')) - 1;
|
||||
} else {
|
||||
var newValue = parseInt($('[type=text]', $(this)).attr('value')) + 1;
|
||||
}
|
||||
$('[type=text]', $(this)).attr('value', newValue);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.cloneMarkedCheckboxes = function () {
|
||||
$('[name="order[]"]', $(tableWrapper)).attr('name', 'order-tmp');
|
||||
$('[type=checkbox]', root.sortableRange).each(function () {
|
||||
var _shadow = $(this).clone();
|
||||
$(_shadow).attr({'checked':'checked', 'shadow':'shadow', 'id':''});
|
||||
$('#' + formId).append($(_shadow));
|
||||
|
||||
$('[name="order-tmp"]', $(this).parents('tr')).attr('name', 'order[]');
|
||||
});
|
||||
}
|
||||
|
||||
this.removeClonedCheckboxes = function () {
|
||||
$('[shadow=shadow]').remove();
|
||||
$('[name="order-tmp"]', $(tableWrapper)).attr('name', 'order[]');
|
||||
}
|
||||
|
||||
this.getChildrenNodes = function (parentId) {
|
||||
return $('tr[parents*=" '+parentId+'"]');
|
||||
}
|
||||
|
||||
this.getSameLevelNodes = function (level) {
|
||||
return $('tr[level='+level+']');
|
||||
}
|
||||
|
||||
}
|
||||
})(jQuery);
|
116
media/jui/js/treeselectmenu.jquery.js
Normal file
116
media/jui/js/treeselectmenu.jquery.js
Normal file
@ -0,0 +1,116 @@
|
||||
/**
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
jQuery(function($)
|
||||
{
|
||||
var treeselectmenu = $('div#treeselectmenu').html();
|
||||
|
||||
$('.treeselect li').each(function()
|
||||
{
|
||||
$li = $(this);
|
||||
$div = $li.find('div.treeselect-item:first');
|
||||
|
||||
// Add icons
|
||||
$li.prepend('<i class="pull-left icon-"></i>');
|
||||
|
||||
// Append clearfix
|
||||
$div.after('<div class="clearfix"></div>');
|
||||
|
||||
if ($li.find('ul.treeselect-sub').length) {
|
||||
// Add classes to Expand/Collapse icons
|
||||
$li.find('i').addClass('treeselect-toggle icon-minus');
|
||||
|
||||
// Append drop down menu in nodes
|
||||
$div.find('label:first').after(treeselectmenu);
|
||||
|
||||
if (!$li.find('ul.treeselect-sub ul.treeselect-sub').length) {
|
||||
$li.find('div.treeselect-menu-expand').remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Takes care of the Expand/Collapse of a node
|
||||
$('i.treeselect-toggle').click(function()
|
||||
{
|
||||
$i = $(this);
|
||||
|
||||
// Take care of parent UL
|
||||
if ($i.parent().find('ul.treeselect-sub').is(':visible')) {
|
||||
$i.removeClass('icon-minus').addClass('icon-plus');
|
||||
$i.parent().find('ul.treeselect-sub').hide();
|
||||
$i.parent().find('ul.treeselect-sub i.treeselect-toggle').removeClass('icon-minus').addClass('icon-plus');
|
||||
} else {
|
||||
$i.removeClass('icon-plus').addClass('icon-minus');
|
||||
$i.parent().find('ul.treeselect-sub').show();
|
||||
$i.parent().find('ul.treeselect-sub i.treeselect-toggle').removeClass('icon-plus').addClass('icon-minus');
|
||||
}
|
||||
});
|
||||
|
||||
// Takes care of the filtering
|
||||
$('#treeselectfilter').keyup(function()
|
||||
{
|
||||
var text = $(this).val().toLowerCase();
|
||||
$('.treeselect li').each(function()
|
||||
{
|
||||
if ($(this).text().toLowerCase().indexOf(text) == -1) {
|
||||
$(this).hide();
|
||||
}
|
||||
else {
|
||||
$(this).show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Checks all checkboxes the tree
|
||||
$('#treeCheckAll').click(function()
|
||||
{
|
||||
$('.treeselect input').attr('checked', 'checked');
|
||||
});
|
||||
|
||||
// Unchecks all checkboxes the tree
|
||||
$('#treeUncheckAll').click(function()
|
||||
{
|
||||
$('.treeselect input').attr('checked', false);
|
||||
});
|
||||
|
||||
// Checks all checkboxes the tree
|
||||
$('#treeExpandAll').click(function()
|
||||
{
|
||||
$('ul.treeselect ul.treeselect-sub').show();
|
||||
$('ul.treeselect i.treeselect-toggle').removeClass('icon-plus').addClass('icon-minus');
|
||||
});
|
||||
|
||||
// Unchecks all checkboxes the tree
|
||||
$('#treeCollapseAll').click(function()
|
||||
{
|
||||
$('ul.treeselect ul.treeselect-sub').hide();
|
||||
$('ul.treeselect i.treeselect-toggle').removeClass('icon-minus').addClass('icon-plus');
|
||||
});
|
||||
|
||||
// Take care of children check/uncheck all
|
||||
$('a.checkall').click(function()
|
||||
{
|
||||
$(this).parent().parent().parent().parent().parent().parent().find('ul.treeselect-sub input').attr('checked', 'checked');
|
||||
});
|
||||
$('a.uncheckall').click(function()
|
||||
{
|
||||
$(this).parent().parent().parent().parent().parent().parent().find('ul.treeselect-sub input').attr('checked', false);
|
||||
});
|
||||
|
||||
// Take care of children toggle all
|
||||
$('a.expandall').click(function()
|
||||
{
|
||||
$parent = $(this).parent().parent().parent().parent().parent().parent().parent();
|
||||
$parent.find('ul.treeselect-sub').show();
|
||||
$parent.find('ul.treeselect-sub i.treeselect-toggle').removeClass('icon-plus').addClass('icon-minus');
|
||||
;
|
||||
});
|
||||
$('a.collapseall').click(function()
|
||||
{
|
||||
$parent = $(this).parent().parent().parent().parent().parent().parent().parent();
|
||||
$parent.find('li ul.treeselect-sub').hide();
|
||||
$parent.find('li i.treeselect-toggle').removeClass('icon-minus').addClass('icon-plus');
|
||||
;
|
||||
});
|
||||
});
|
5
media/jui/js/treeselectmenu.jquery.min.js
vendored
Normal file
5
media/jui/js/treeselectmenu.jquery.min.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('K(7($){u q=$(\'h#q\').C();$(\'.2 8\').x(7(){$8=$(9);$h=$8.5(\'h.2-O:w\');$8.D(\'<i t="P-B 4-"></i>\');$h.y(\'<h t="E"></h>\');m($8.5(\'3.2-6\').v){$8.5(\'i\').b(\'2-e 4-d\');$h.5(\'F:w\').y(q);m(!$8.5(\'3.2-6 3.2-6\').v){$8.5(\'h.2-I-A\').N()}}});$(\'i.2-e\').c(7(){$i=$(9);m($i.0().5(\'3.2-6\').R(\':U\')){$i.f(\'4-d\').b(\'4-g\');$i.0().5(\'3.2-6\').l();$i.0().5(\'3.2-6 i.2-e\').f(\'4-d\').b(\'4-g\')}s{$i.f(\'4-g\').b(\'4-d\');$i.0().5(\'3.2-6\').o();$i.0().5(\'3.2-6 i.2-e\').f(\'4-g\').b(\'4-d\')}});$(\'#G\').H(7(){u p=$(9).J().r();$(\'.2 8\').x(7(){m($(9).p().r().L(p)==-1){$(9).l()}s{$(9).o()}})});$(\'#M\').c(7(){$(\'.2 n\').k(\'j\',\'j\')});$(\'#Q\').c(7(){$(\'.2 n\').k(\'j\',z)});$(\'#S\').c(7(){$(\'3.2 3.2-6\').o();$(\'3.2 i.2-e\').f(\'4-g\').b(\'4-d\')});$(\'#T\').c(7(){$(\'3.2 3.2-6\').l();$(\'3.2 i.2-e\').f(\'4-d\').b(\'4-g\')});$(\'a.V\').c(7(){$(9).0().0().0().0().0().0().5(\'3.2-6 n\').k(\'j\',\'j\')});$(\'a.W\').c(7(){$(9).0().0().0().0().0().0().5(\'3.2-6 n\').k(\'j\',z)});$(\'a.X\').c(7(){$0=$(9).0().0().0().0().0().0().0();$0.5(\'3.2-6\').o();$0.5(\'3.2-6 i.2-e\').f(\'4-g\').b(\'4-d\')});$(\'a.Y\').c(7(){$0=$(9).0().0().0().0().0().0().0();$0.5(\'8 3.2-6\').l();$0.5(\'8 i.2-e\').f(\'4-d\').b(\'4-g\')})});',61,61,'parent||treeselect|ul|icon|find|sub|function|li|this||addClass|click|minus|toggle|removeClass|plus|div||checked|attr|hide|if|input|show|text|treeselectmenu|toLowerCase|else|class|var|length|first|each|after|false|expand|left|html|prepend|clearfix|label|treeselectfilter|keyup|menu|val|jQuery|indexOf|treeCheckAll|remove|item|pull|treeUncheckAll|is|treeExpandAll|treeCollapseAll|visible|checkall|uncheckall|expandall|collapseall'.split('|'),0,{}))
|
Reference in New Issue
Block a user