[+] Classes : added new class Media => It contains all the method related to media like CSS, JS
[+] Classes : added new method Media::addJquery(), Media::addJqueryUI(), Media::addJqueryPlugin() [~] Deprecated : All method related to CCC has been moved in class Media git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8926 b9a71923-0436-4b27-9f14-aed3839534dd
@@ -0,0 +1,31 @@
|
||||
.qq-uploader { position:relative; width: 100%;}
|
||||
|
||||
.qq-upload-button {
|
||||
display:block; /* or inline-block */
|
||||
width: 105px; padding: 7px 0; text-align:center;
|
||||
background:#880000; border-bottom:1px solid #ddd;color:#fff;
|
||||
}
|
||||
.qq-upload-button-hover {background:#cc0000;}
|
||||
.qq-upload-button-focus {outline:1px dotted black;}
|
||||
|
||||
.qq-upload-drop-area {
|
||||
position:absolute; top:0; left:0; width:100%; height:100%; min-height: 70px; z-index:2;
|
||||
background:#FF9797; text-align:center;
|
||||
}
|
||||
.qq-upload-drop-area span {
|
||||
display:block; position:absolute; top: 50%; width:100%; margin-top:-8px; font-size:16px;
|
||||
}
|
||||
.qq-upload-drop-area-active {background:#FF7171;}
|
||||
|
||||
.qq-upload-list {margin:15px 35px; padding:0; list-style:disc;}
|
||||
.qq-upload-list li { margin:0; padding:0; line-height:15px; font-size:12px;}
|
||||
.qq-upload-file, .qq-upload-spinner, .qq-upload-size, .qq-upload-cancel, .qq-upload-failed-text {
|
||||
margin-right: 7px;
|
||||
}
|
||||
|
||||
.qq-upload-file {}
|
||||
.qq-upload-spinner {display:inline-block; background: url("loading.gif"); width:15px; height:15px; vertical-align:text-bottom;}
|
||||
.qq-upload-size,.qq-upload-cancel {font-size:11px;}
|
||||
|
||||
.qq-upload-failed-text {display:none;}
|
||||
.qq-upload-fail .qq-upload-failed-text {display:inline;}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* this file come from:
|
||||
* http://www.phpletter.com/Demo/AjaxFileUpload-Demo/
|
||||
* v 1.0
|
||||
*/
|
||||
|
||||
jQuery.extend({createUploadIframe:function(id,uri)
|
||||
{var frameId='jUploadFrame'+id;if(window.ActiveXObject){var io=document.createElement('<iframe id="'+frameId+'" name="'+frameId+'" />');if(typeof uri=='boolean'){io.src='javascript:false';}
|
||||
else if(typeof uri=='string'){io.src=uri;}}
|
||||
else{var io=document.createElement('iframe');io.id=frameId;io.name=frameId;}
|
||||
io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);return io},createUploadForm:function(id,fileElementId)
|
||||
{var formId='jUploadForm'+id;var fileId='jUploadFile'+id;var form=$('<form action="" method="POST" name="'+formId+'" id="'+formId+'" enctype="multipart/form-data"></form>');var oldElement=$('#'+fileElementId);var newElement=$(oldElement).clone();$(oldElement).attr('id',fileId);$(oldElement).before(newElement);$(oldElement).appendTo(form);$(form).css('position','absolute');$(form).css('top','-1200px');$(form).css('left','-1200px');$(form).appendTo('body');return form;},ajaxFileUpload:function(s){s=jQuery.extend({},jQuery.ajaxSettings,s);var id=new Date().getTime()
|
||||
var form=jQuery.createUploadForm(id,s.fileElementId);var io=jQuery.createUploadIframe(id,s.secureuri);var frameId='jUploadFrame'+id;var formId='jUploadForm'+id;if(s.global&&!jQuery.active++)
|
||||
{jQuery.event.trigger("ajaxStart");}
|
||||
var requestDone=false;var xml={}
|
||||
if(s.global)
|
||||
jQuery.event.trigger("ajaxSend",[xml,s]);var uploadCallback=function(isTimeout)
|
||||
{var io=document.getElementById(frameId);try
|
||||
{if(io.contentWindow)
|
||||
{xml.responseText=io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;xml.responseXML=io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;}else if(io.contentDocument)
|
||||
{xml.responseText=io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;xml.responseXML=io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;}}catch(e)
|
||||
{jQuery.handleError(s,xml,null,e);}
|
||||
if(xml||isTimeout=="timeout")
|
||||
{requestDone=true;var status;try{status=isTimeout!="timeout"?"success":"error";if(status!="error")
|
||||
{var data=jQuery.uploadHttpData(xml,s.dataType);if(s.success)
|
||||
s.success(data,status);if(s.global)
|
||||
jQuery.event.trigger("ajaxSuccess",[xml,s]);}else
|
||||
jQuery.handleError(s,xml,status);}catch(e)
|
||||
{status="error";jQuery.handleError(s,xml,status,e);}
|
||||
if(s.global)
|
||||
jQuery.event.trigger("ajaxComplete",[xml,s]);if(s.global&&!--jQuery.active)
|
||||
jQuery.event.trigger("ajaxStop");if(s.complete)
|
||||
s.complete(xml,status);jQuery(io).unbind()
|
||||
setTimeout(function()
|
||||
{try
|
||||
{$(io).remove();$(form).remove();}catch(e)
|
||||
{jQuery.handleError(s,xml,null,e);}},100)
|
||||
xml=null}}
|
||||
if(s.timeout>0)
|
||||
{setTimeout(function(){if(!requestDone)uploadCallback("timeout");},s.timeout);}
|
||||
try
|
||||
{var form=$('#'+formId);$(form).attr('action',s.url);$(form).attr('method','POST');$(form).attr('target',frameId);if(form.encoding)
|
||||
{form.encoding='multipart/form-data';}
|
||||
else
|
||||
{form.enctype='multipart/form-data';}
|
||||
$(form).submit();}catch(e)
|
||||
{jQuery.handleError(s,xml,null,e);}
|
||||
if(window.attachEvent){document.getElementById(frameId).attachEvent('onload',uploadCallback);}
|
||||
else{document.getElementById(frameId).addEventListener('load',uploadCallback,false);}
|
||||
return{abort:function(){}};},uploadHttpData:function(r,type){var data=!type;data=type=="xml"||data?r.responseXML:r.responseText;if(type=="script")
|
||||
jQuery.globalEval(data);if(type=="json")
|
||||
eval("data = "+data);if(type=="html")
|
||||
jQuery("<div>").html(data).evalScripts();return data;}})
|
||||
@@ -0,0 +1,51 @@
|
||||
.ac_results {
|
||||
text-align: left;
|
||||
padding: 0px;
|
||||
border: 1px solid black;
|
||||
background-color: white;
|
||||
overflow: hidden;
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
.ac_results ul {
|
||||
width: 100%;
|
||||
list-style-position: outside;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.ac_results li {
|
||||
margin: 0px;
|
||||
padding: 2px 5px;
|
||||
cursor: default;
|
||||
display: block;
|
||||
/*
|
||||
if width will be 100% horizontal scrollbar will apear
|
||||
when scroll mode will be used
|
||||
*/
|
||||
/*width: 100%;*/
|
||||
font: menu;
|
||||
font-size: 12px;
|
||||
/*
|
||||
it is very important, if line-height not setted or setted
|
||||
in relative units scroll will be broken in firefox
|
||||
*/
|
||||
line-height: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/*
|
||||
.ac_loading {
|
||||
background: white url('indicator.gif') right center no-repeat;
|
||||
}
|
||||
*/
|
||||
|
||||
.ac_odd {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
.ac_over {
|
||||
background-color: #0A246A;
|
||||
color: white;
|
||||
}
|
||||
@@ -0,0 +1,758 @@
|
||||
/*
|
||||
* Autocomplete - jQuery plugin 1.0.2
|
||||
*
|
||||
* Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Revision: $Id: jquery.autocomplete.js 6844 2011-06-03 14:46:51Z dMetzger $
|
||||
*
|
||||
*/
|
||||
|
||||
;(function($) {
|
||||
|
||||
$.fn.extend({
|
||||
autocomplete: function(urlOrData, options) {
|
||||
var isUrl = typeof urlOrData == "string";
|
||||
options = $.extend({}, $.Autocompleter.defaults, {
|
||||
url: isUrl ? urlOrData : null,
|
||||
data: isUrl ? null : urlOrData,
|
||||
delay: isUrl ? $.Autocompleter.defaults.delay : 10,
|
||||
max: options && !options.scroll ? 10 : 150
|
||||
}, options);
|
||||
|
||||
// if highlight is set to false, replace it with a do-nothing function
|
||||
options.highlight = options.highlight || function(value) { return value; };
|
||||
|
||||
// if the formatMatch option is not specified, then use formatItem for backwards compatibility
|
||||
options.formatMatch = options.formatMatch || options.formatItem;
|
||||
|
||||
return this.each(function() {
|
||||
new $.Autocompleter(this, options);
|
||||
});
|
||||
},
|
||||
result: function(handler) {
|
||||
return this.bind("result", handler);
|
||||
},
|
||||
search: function(handler) {
|
||||
return this.trigger("search", [handler]);
|
||||
},
|
||||
flushCache: function() {
|
||||
return this.trigger("flushCache");
|
||||
},
|
||||
setOptions: function(options){
|
||||
return this.trigger("setOptions", [options]);
|
||||
},
|
||||
unautocomplete: function() {
|
||||
return this.trigger("unautocomplete");
|
||||
}
|
||||
});
|
||||
|
||||
$.Autocompleter = function(input, options) {
|
||||
|
||||
var KEY = {
|
||||
UP: 38,
|
||||
DOWN: 40,
|
||||
DEL: 46,
|
||||
TAB: 9,
|
||||
RETURN: 13,
|
||||
ESC: 27,
|
||||
COMMA: 188,
|
||||
PAGEUP: 33,
|
||||
PAGEDOWN: 34,
|
||||
BACKSPACE: 8
|
||||
};
|
||||
|
||||
// Create $ object for input element
|
||||
var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);
|
||||
|
||||
var timeout;
|
||||
var previousValue = "";
|
||||
var cache = $.Autocompleter.Cache(options);
|
||||
var hasFocus = 0;
|
||||
var lastKeyPressCode;
|
||||
var config = {
|
||||
mouseDownOnSelect: false
|
||||
};
|
||||
var select = $.Autocompleter.Select(options, input, selectCurrent, config);
|
||||
|
||||
var blockSubmit;
|
||||
|
||||
// prevent form submit in opera when selecting with return key
|
||||
$.browser.opera && $(input.form).bind("submit.autocomplete", function() {
|
||||
if (blockSubmit) {
|
||||
blockSubmit = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all
|
||||
$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
|
||||
// track last key pressed
|
||||
lastKeyPressCode = event.keyCode;
|
||||
switch(event.keyCode) {
|
||||
|
||||
case KEY.UP:
|
||||
event.preventDefault();
|
||||
if ( select.visible() ) {
|
||||
select.prev();
|
||||
} else {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY.DOWN:
|
||||
event.preventDefault();
|
||||
if ( select.visible() ) {
|
||||
select.next();
|
||||
} else {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY.PAGEUP:
|
||||
event.preventDefault();
|
||||
if ( select.visible() ) {
|
||||
select.pageUp();
|
||||
} else {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY.PAGEDOWN:
|
||||
event.preventDefault();
|
||||
if ( select.visible() ) {
|
||||
select.pageDown();
|
||||
} else {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
// matches also semicolon
|
||||
case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
|
||||
case KEY.TAB:
|
||||
case KEY.RETURN:
|
||||
if( selectCurrent() ) {
|
||||
// stop default to prevent a form submit, Opera needs special handling
|
||||
event.preventDefault();
|
||||
blockSubmit = true;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY.ESC:
|
||||
select.hide();
|
||||
break;
|
||||
|
||||
default:
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(onChange, options.delay);
|
||||
break;
|
||||
}
|
||||
}).focus(function(){
|
||||
// track whether the field has focus, we shouldn't process any
|
||||
// results if the field no longer has focus
|
||||
hasFocus++;
|
||||
}).blur(function() {
|
||||
hasFocus = 0;
|
||||
if (!config.mouseDownOnSelect) {
|
||||
hideResults();
|
||||
}
|
||||
}).click(function() {
|
||||
// show select when clicking in a focused field
|
||||
if ( hasFocus++ > 1 && !select.visible() ) {
|
||||
onChange(0, true);
|
||||
}
|
||||
}).bind("search", function() {
|
||||
// TODO why not just specifying both arguments?
|
||||
var fn = (arguments.length > 1) ? arguments[1] : null;
|
||||
function findValueCallback(q, data) {
|
||||
var result;
|
||||
if( data && data.length ) {
|
||||
for (var i=0; i < data.length; i++) {
|
||||
if( data[i].result.toLowerCase() == q.toLowerCase() ) {
|
||||
result = data[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( typeof fn == "function" ) fn(result);
|
||||
else $input.trigger("result", result && [result.data, result.value]);
|
||||
}
|
||||
$.each(trimWords($input.val()), function(i, value) {
|
||||
request(value, findValueCallback, findValueCallback);
|
||||
});
|
||||
}).bind("flushCache", function() {
|
||||
cache.flush();
|
||||
}).bind("setOptions", function() {
|
||||
$.extend(options, arguments[1]);
|
||||
// if we've updated the data, repopulate
|
||||
if ( "data" in arguments[1] )
|
||||
cache.populate();
|
||||
}).bind("unautocomplete", function() {
|
||||
select.unbind();
|
||||
$input.unbind();
|
||||
$(input.form).unbind(".autocomplete");
|
||||
});
|
||||
|
||||
|
||||
function selectCurrent() {
|
||||
var selected = select.selected();
|
||||
if( !selected )
|
||||
return false;
|
||||
|
||||
var v = selected.result;
|
||||
previousValue = v;
|
||||
|
||||
if ( options.multiple ) {
|
||||
var words = trimWords($input.val());
|
||||
if ( words.length > 1 ) {
|
||||
v = words.slice(0, words.length - 1).join( options.multipleSeparator ) + options.multipleSeparator + v;
|
||||
}
|
||||
v += options.multipleSeparator;
|
||||
}
|
||||
|
||||
$input.val(v);
|
||||
hideResultsNow();
|
||||
$input.trigger("result", [selected.data, selected.value]);
|
||||
return true;
|
||||
}
|
||||
|
||||
function onChange(crap, skipPrevCheck) {
|
||||
if( lastKeyPressCode == KEY.DEL ) {
|
||||
select.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
var currentValue = $input.val();
|
||||
|
||||
if ( !skipPrevCheck && currentValue == previousValue )
|
||||
return;
|
||||
|
||||
previousValue = currentValue;
|
||||
|
||||
currentValue = lastWord(currentValue);
|
||||
if ( currentValue.length >= options.minChars) {
|
||||
$input.addClass(options.loadingClass);
|
||||
if (!options.matchCase)
|
||||
currentValue = currentValue.toLowerCase();
|
||||
request(currentValue, receiveData, hideResultsNow);
|
||||
} else {
|
||||
stopLoading();
|
||||
select.hide();
|
||||
}
|
||||
};
|
||||
|
||||
function trimWords(value) {
|
||||
if ( !value ) {
|
||||
return [""];
|
||||
}
|
||||
var words = value.split( options.multipleSeparator );
|
||||
var result = [];
|
||||
$.each(words, function(i, value) {
|
||||
if ( $.trim(value) )
|
||||
result[i] = $.trim(value);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function lastWord(value) {
|
||||
if ( !options.multiple )
|
||||
return value;
|
||||
var words = trimWords(value);
|
||||
return words[words.length - 1];
|
||||
}
|
||||
|
||||
// fills in the input box w/the first match (assumed to be the best match)
|
||||
// q: the term entered
|
||||
// sValue: the first matching result
|
||||
function autoFill(q, sValue){
|
||||
// autofill in the complete box w/the first match as long as the user hasn't entered in more data
|
||||
// if the last user key pressed was backspace, don't autofill
|
||||
if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) {
|
||||
// fill in the value (keep the case the user has typed)
|
||||
$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
|
||||
// select the portion of the value not typed by the user (so the next character will erase)
|
||||
$.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length);
|
||||
}
|
||||
};
|
||||
|
||||
function hideResults() {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(hideResultsNow, 200);
|
||||
};
|
||||
|
||||
function hideResultsNow() {
|
||||
var wasVisible = select.visible();
|
||||
select.hide();
|
||||
clearTimeout(timeout);
|
||||
stopLoading();
|
||||
if (options.mustMatch) {
|
||||
// call search and run callback
|
||||
$input.search(
|
||||
function (result){
|
||||
// if no value found, clear the input box
|
||||
if( !result ) {
|
||||
if (options.multiple) {
|
||||
var words = trimWords($input.val()).slice(0, -1);
|
||||
$input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") );
|
||||
}
|
||||
else
|
||||
$input.val( "" );
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
if (wasVisible)
|
||||
// position cursor at end of input field
|
||||
$.Autocompleter.Selection(input, input.value.length, input.value.length);
|
||||
};
|
||||
|
||||
function receiveData(q, data) {
|
||||
if ( data && data.length && hasFocus ) {
|
||||
stopLoading();
|
||||
select.display(data, q);
|
||||
autoFill(q, data[0].value);
|
||||
select.show();
|
||||
} else {
|
||||
hideResultsNow();
|
||||
}
|
||||
};
|
||||
|
||||
function request(term, success, failure) {
|
||||
if (!options.matchCase)
|
||||
term = term.toLowerCase();
|
||||
var data = cache.load(term);
|
||||
// recieve the cached data
|
||||
if (data && data.length) {
|
||||
success(term, data);
|
||||
// if an AJAX url has been supplied, try loading the data now
|
||||
} else if( (typeof options.url == "string") && (options.url.length > 0) ){
|
||||
|
||||
var extraParams = {
|
||||
timestamp: +new Date()
|
||||
};
|
||||
$.each(options.extraParams, function(key, param) {
|
||||
extraParams[key] = typeof param == "function" ? param() : param;
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
// try to leverage ajaxQueue plugin to abort previous requests
|
||||
mode: "abort",
|
||||
// limit abortion to this input
|
||||
port: "autocomplete" + input.name,
|
||||
dataType: options.dataType,
|
||||
url: options.url,
|
||||
data: $.extend({
|
||||
q: lastWord(term),
|
||||
limit: options.max
|
||||
}, extraParams),
|
||||
success: function(data) {
|
||||
var parsed = options.parse && options.parse(data) || parse(data);
|
||||
cache.add(term, parsed);
|
||||
success(term, parsed);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
|
||||
select.emptyList();
|
||||
failure(term);
|
||||
}
|
||||
};
|
||||
|
||||
function parse(data) {
|
||||
var parsed = [];
|
||||
var rows = data.split("\n");
|
||||
for (var i=0; i < rows.length; i++) {
|
||||
var row = $.trim(rows[i]);
|
||||
if (row) {
|
||||
row = row.split("|");
|
||||
parsed[parsed.length] = {
|
||||
data: row,
|
||||
value: row[0],
|
||||
result: options.formatResult && options.formatResult(row, row[0]) || row[0]
|
||||
};
|
||||
}
|
||||
}
|
||||
return parsed;
|
||||
};
|
||||
|
||||
function stopLoading() {
|
||||
$input.removeClass(options.loadingClass);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
$.Autocompleter.defaults = {
|
||||
inputClass: "ac_input",
|
||||
resultsClass: "ac_results",
|
||||
loadingClass: "ac_loading",
|
||||
minChars: 1,
|
||||
delay: 400,
|
||||
matchCase: false,
|
||||
matchSubset: true,
|
||||
matchContains: false,
|
||||
cacheLength: 10,
|
||||
max: 100,
|
||||
mustMatch: false,
|
||||
extraParams: {},
|
||||
selectFirst: true,
|
||||
formatItem: function(row) { return row[0]; },
|
||||
formatMatch: null,
|
||||
autoFill: false,
|
||||
width: 0,
|
||||
multiple: false,
|
||||
multipleSeparator: ", ",
|
||||
highlight: function(value, term) {
|
||||
return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
|
||||
},
|
||||
scroll: true,
|
||||
scrollHeight: 180
|
||||
};
|
||||
|
||||
$.Autocompleter.Cache = function(options) {
|
||||
|
||||
var data = {};
|
||||
var length = 0;
|
||||
|
||||
function matchSubset(s, sub) {
|
||||
if (!options.matchCase)
|
||||
s = s.toLowerCase();
|
||||
var i = s.indexOf(sub);
|
||||
if (i == -1) return false;
|
||||
return i == 0 || options.matchContains;
|
||||
};
|
||||
|
||||
function add(q, value) {
|
||||
if (length > options.cacheLength){
|
||||
flush();
|
||||
}
|
||||
if (!data[q]){
|
||||
length++;
|
||||
}
|
||||
data[q] = value;
|
||||
}
|
||||
|
||||
function populate(){
|
||||
if( !options.data ) return false;
|
||||
// track the matches
|
||||
var stMatchSets = {},
|
||||
nullData = 0;
|
||||
|
||||
// no url was specified, we need to adjust the cache length to make sure it fits the local data store
|
||||
if( !options.url ) options.cacheLength = 1;
|
||||
|
||||
// track all options for minChars = 0
|
||||
stMatchSets[""] = [];
|
||||
|
||||
// loop through the array and create a lookup structure
|
||||
for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
|
||||
var rawValue = options.data[i];
|
||||
// if rawValue is a string, make an array otherwise just reference the array
|
||||
rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
|
||||
|
||||
var value = options.formatMatch(rawValue, i+1, options.data.length);
|
||||
if ( value === false )
|
||||
continue;
|
||||
|
||||
var firstChar = value.charAt(0).toLowerCase();
|
||||
// if no lookup array for this character exists, look it up now
|
||||
if( !stMatchSets[firstChar] )
|
||||
stMatchSets[firstChar] = [];
|
||||
|
||||
// if the match is a string
|
||||
var row = {
|
||||
value: value,
|
||||
data: rawValue,
|
||||
result: options.formatResult && options.formatResult(rawValue) || value
|
||||
};
|
||||
|
||||
// push the current match into the set list
|
||||
stMatchSets[firstChar].push(row);
|
||||
|
||||
// keep track of minChars zero items
|
||||
if ( nullData++ < options.max ) {
|
||||
stMatchSets[""].push(row);
|
||||
}
|
||||
};
|
||||
|
||||
// add the data items to the cache
|
||||
$.each(stMatchSets, function(i, value) {
|
||||
// increase the cache size
|
||||
options.cacheLength++;
|
||||
// add to the cache
|
||||
add(i, value);
|
||||
});
|
||||
}
|
||||
|
||||
// populate any existing data
|
||||
setTimeout(populate, 25);
|
||||
|
||||
function flush(){
|
||||
data = {};
|
||||
length = 0;
|
||||
}
|
||||
|
||||
return {
|
||||
flush: flush,
|
||||
add: add,
|
||||
populate: populate,
|
||||
load: function(q) {
|
||||
if (!options.cacheLength || !length)
|
||||
return null;
|
||||
/*
|
||||
* if dealing w/local data and matchContains than we must make sure
|
||||
* to loop through all the data collections looking for matches
|
||||
*/
|
||||
if( !options.url && options.matchContains ){
|
||||
// track all matches
|
||||
var csub = [];
|
||||
// loop through all the data grids for matches
|
||||
for( var k in data ){
|
||||
// don't search through the stMatchSets[""] (minChars: 0) cache
|
||||
// this prevents duplicates
|
||||
if( k.length > 0 ){
|
||||
var c = data[k];
|
||||
$.each(c, function(i, x) {
|
||||
// if we've got a match, add it to the array
|
||||
if (matchSubset(x.value, q)) {
|
||||
csub.push(x);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return csub;
|
||||
} else
|
||||
// if the exact item exists, use it
|
||||
if (data[q]){
|
||||
return data[q];
|
||||
} else
|
||||
if (options.matchSubset) {
|
||||
for (var i = q.length - 1; i >= options.minChars; i--) {
|
||||
var c = data[q.substr(0, i)];
|
||||
if (c) {
|
||||
var csub = [];
|
||||
$.each(c, function(i, x) {
|
||||
if (matchSubset(x.value, q)) {
|
||||
csub[csub.length] = x;
|
||||
}
|
||||
});
|
||||
return csub;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
$.Autocompleter.Select = function (options, input, select, config) {
|
||||
var CLASSES = {
|
||||
ACTIVE: "ac_over"
|
||||
};
|
||||
|
||||
var listItems,
|
||||
active = -1,
|
||||
data,
|
||||
term = "",
|
||||
needsInit = true,
|
||||
element,
|
||||
list;
|
||||
|
||||
// Create results
|
||||
function init() {
|
||||
if (!needsInit)
|
||||
return;
|
||||
element = $("<div/>")
|
||||
.hide()
|
||||
.addClass(options.resultsClass)
|
||||
.css("position", "absolute")
|
||||
.appendTo(document.body);
|
||||
|
||||
list = $("<ul/>").appendTo(element).mouseover( function(event) {
|
||||
if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
|
||||
active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
|
||||
$(target(event)).addClass(CLASSES.ACTIVE);
|
||||
}
|
||||
}).click(function(event) {
|
||||
$(target(event)).addClass(CLASSES.ACTIVE);
|
||||
select();
|
||||
// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus
|
||||
input.focus();
|
||||
return false;
|
||||
}).mousedown(function() {
|
||||
config.mouseDownOnSelect = true;
|
||||
}).mouseup(function() {
|
||||
config.mouseDownOnSelect = false;
|
||||
});
|
||||
|
||||
if( options.width > 0 )
|
||||
element.css("width", options.width);
|
||||
|
||||
needsInit = false;
|
||||
}
|
||||
|
||||
function target(event) {
|
||||
var element = event.target;
|
||||
while(element && element.tagName != "LI")
|
||||
element = element.parentNode;
|
||||
// more fun with IE, sometimes event.target is empty, just ignore it then
|
||||
if(!element)
|
||||
return [];
|
||||
return element;
|
||||
}
|
||||
|
||||
function moveSelect(step) {
|
||||
listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
|
||||
movePosition(step);
|
||||
var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
|
||||
if(options.scroll) {
|
||||
var offset = 0;
|
||||
listItems.slice(0, active).each(function() {
|
||||
offset += this.offsetHeight;
|
||||
});
|
||||
if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
|
||||
list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
|
||||
} else if(offset < list.scrollTop()) {
|
||||
list.scrollTop(offset);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function movePosition(step) {
|
||||
active += step;
|
||||
if (active < 0) {
|
||||
active = listItems.size() - 1;
|
||||
} else if (active >= listItems.size()) {
|
||||
active = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function limitNumberOfItems(available) {
|
||||
return options.max && options.max < available
|
||||
? options.max
|
||||
: available;
|
||||
}
|
||||
|
||||
function fillList() {
|
||||
list.empty();
|
||||
var max = limitNumberOfItems(data.length);
|
||||
for (var i=0; i < max; i++) {
|
||||
if (!data[i])
|
||||
continue;
|
||||
var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term);
|
||||
if ( formatted === false )
|
||||
continue;
|
||||
var li = $("<li/>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
|
||||
$.data(li, "ac_data", data[i]);
|
||||
}
|
||||
listItems = list.find("li");
|
||||
if ( options.selectFirst ) {
|
||||
listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
|
||||
active = 0;
|
||||
}
|
||||
// apply bgiframe if available
|
||||
if ( $.fn.bgiframe )
|
||||
list.bgiframe();
|
||||
}
|
||||
|
||||
return {
|
||||
display: function(d, q) {
|
||||
init();
|
||||
data = d;
|
||||
term = q;
|
||||
fillList();
|
||||
},
|
||||
next: function() {
|
||||
moveSelect(1);
|
||||
},
|
||||
prev: function() {
|
||||
moveSelect(-1);
|
||||
},
|
||||
pageUp: function() {
|
||||
if (active != 0 && active - 8 < 0) {
|
||||
moveSelect( -active );
|
||||
} else {
|
||||
moveSelect(-8);
|
||||
}
|
||||
},
|
||||
pageDown: function() {
|
||||
if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
|
||||
moveSelect( listItems.size() - 1 - active );
|
||||
} else {
|
||||
moveSelect(8);
|
||||
}
|
||||
},
|
||||
hide: function() {
|
||||
element && element.hide();
|
||||
listItems && listItems.removeClass(CLASSES.ACTIVE);
|
||||
active = -1;
|
||||
},
|
||||
visible : function() {
|
||||
return element && element.is(":visible");
|
||||
},
|
||||
current: function() {
|
||||
return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
|
||||
},
|
||||
show: function() {
|
||||
var offset = $(input).offset();
|
||||
element.css({
|
||||
width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
|
||||
top: offset.top + input.offsetHeight,
|
||||
left: offset.left
|
||||
}).show();
|
||||
if(options.scroll) {
|
||||
list.css({
|
||||
maxHeight: options.scrollHeight,
|
||||
overflow: 'auto'
|
||||
});
|
||||
|
||||
if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
|
||||
var listHeight = 0;
|
||||
listItems.each(function() {
|
||||
listHeight += this.offsetHeight;
|
||||
});
|
||||
var scrollbarsVisible = listHeight > options.scrollHeight;
|
||||
list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
|
||||
if (!scrollbarsVisible) {
|
||||
// IE doesn't recalculate width when scrollbar disappears
|
||||
listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
selected: function() {
|
||||
var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
|
||||
return selected && selected.length && $.data(selected[0], "ac_data");
|
||||
},
|
||||
emptyList: function (){
|
||||
list && list.empty();
|
||||
},
|
||||
unbind: function() {
|
||||
element && element.remove();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
$.Autocompleter.Selection = function(field, start, end) {
|
||||
if( field.createTextRange ){
|
||||
var selRange = field.createTextRange();
|
||||
selRange.collapse(true);
|
||||
selRange.moveStart("character", start);
|
||||
selRange.moveEnd("character", end);
|
||||
selRange.select();
|
||||
} else if( field.setSelectionRange ){
|
||||
field.setSelectionRange(start, end);
|
||||
} else {
|
||||
if( field.selectionStart ){
|
||||
field.selectionStart = start;
|
||||
field.selectionEnd = end;
|
||||
}
|
||||
}
|
||||
field.focus();
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,63 @@
|
||||
#cluetip-close img {
|
||||
border: 0;
|
||||
}
|
||||
#cluetip-title {
|
||||
overflow: hidden;
|
||||
}
|
||||
#cluetip-title #cluetip-close {
|
||||
float: right;
|
||||
position: relative;
|
||||
}
|
||||
#cluetip-waitimage {
|
||||
width: 43px;
|
||||
height: 11px;
|
||||
position: absolute;
|
||||
background-image: url('../img/loader.gif');
|
||||
}
|
||||
.cluetip-arrows {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -11px;
|
||||
height: 22px;
|
||||
width: 11px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 0;
|
||||
}
|
||||
#cluetip-extra {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.cluetip-default {
|
||||
background-color: transparent;
|
||||
}
|
||||
.cluetip-default #cluetip-outer {
|
||||
border: 2px solid #ccc;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.cluetip-default h3#cluetip-title {
|
||||
margin: 0 0 5px;
|
||||
padding: 2px 5px;
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
background-color: #ccc;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.cluetip-default #cluetip-inner {
|
||||
padding: 0 5px 5px;
|
||||
display: inline-block;
|
||||
}
|
||||
.cluetip-default div#cluetip-close {
|
||||
text-align: right;
|
||||
margin: 0 5px 5px;
|
||||
color: #900;
|
||||
}
|
||||
|
||||
/* stupid IE6 HasLayout hack */
|
||||
.cluetip-rounded #cluetip-title,
|
||||
.cluetip-rounded #cluetip-inner {
|
||||
zoom: 1;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* documentation & download : http://plugins.learningjquery.com/cluetip/
|
||||
*/
|
||||
/*
|
||||
* jQuery clueTip plugin
|
||||
* Version 0.9.8 (05/22/2008)
|
||||
* @requires jQuery v1.1.4+
|
||||
* @requires Dimensions plugin (for jQuery versions < 1.2.5)
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
;(function($){var $cluetip,$cluetipInner,$cluetipOuter,$cluetipTitle,$cluetipArrows,$dropShadow,imgCount;$.fn.cluetip=function(js,options){if(typeof js=='object'){options=js;js=null;}
|
||||
return this.each(function(index){var $this=$(this);var opts=$.extend(false,{},$.fn.cluetip.defaults,options||{},$.metadata?$this.metadata():$.meta?$this.data():{});var cluetipContents=false;var cluezIndex=parseInt(opts.cluezIndex,10)-1;var isActive=false,closeOnDelay=0;if(!$('#cluetip').length){$cluetipInner=$('<div id="cluetip-inner"></div>');$cluetipTitle=$('<h3 id="cluetip-title"></h3>');$cluetipOuter=$('<div id="cluetip-outer"></div>').append($cluetipInner).prepend($cluetipTitle);$cluetip=$('<div id="cluetip"></div>').css({zIndex:opts.cluezIndex}).append($cluetipOuter).append('<div id="cluetip-extra"></div>')[insertionType](insertionElement).hide();$('<div id="cluetip-waitimage"></div>').css({position:'absolute',zIndex:cluezIndex-1}).insertBefore('#cluetip').hide();$cluetip.css({position:'absolute',zIndex:cluezIndex});$cluetipOuter.css({position:'relative',zIndex:cluezIndex+1});$cluetipArrows=$('<div id="cluetip-arrows" class="cluetip-arrows"></div>').css({zIndex:cluezIndex+1}).appendTo('#cluetip');}
|
||||
var dropShadowSteps=(opts.dropShadow)?+opts.dropShadowSteps:0;if(!$dropShadow){$dropShadow=$([]);for(var i=0;i<dropShadowSteps;i++){$dropShadow=$dropShadow.add($('').css({zIndex:cluezIndex-i-1,opacity:.1,top:1+i,left:1+i}));};$dropShadow.css({position:'absolute',backgroundColor:'#000'}).prependTo($cluetip);}
|
||||
var tipAttribute=$this.attr(opts.attribute),ctClass=opts.cluetipClass;if(!tipAttribute&&!opts.splitTitle&&!js)return true;if(opts.local&&opts.hideLocal){$(tipAttribute+':first').hide();}
|
||||
var tOffset=parseInt(opts.topOffset,10),lOffset=parseInt(opts.leftOffset,10);var tipHeight,wHeight;var defHeight=isNaN(parseInt(opts.height,10))?'auto':(/\D/g).test(opts.height)?opts.height:opts.height+'px';var sTop,linkTop,posY,tipY,mouseY,baseline;var tipInnerWidth=isNaN(parseInt(opts.width,10))?275:parseInt(opts.width,10);var tipWidth=tipInnerWidth+(parseInt($cluetip.css('paddingLeft'))||0)+(parseInt($cluetip.css('paddingRight'))||0)+dropShadowSteps;var linkWidth=this.offsetWidth;var linkLeft,posX,tipX,mouseX,winWidth;var tipParts;var tipTitle=(opts.attribute!='title')?$this.attr(opts.titleAttribute):'';if(opts.splitTitle){if(tipTitle==undefined){tipTitle='';}
|
||||
tipParts=tipTitle.split(opts.splitTitle);tipTitle=tipParts.shift();}
|
||||
var localContent;var activate=function(event){if(!opts.onActivate($this)){return false;}
|
||||
isActive=true;$cluetip.removeClass().css({width:tipInnerWidth});if(tipAttribute==$this.attr('href')){$this.css('cursor',opts.cursor);}
|
||||
$this.attr('title','');if(opts.hoverClass){$this.addClass(opts.hoverClass);}
|
||||
linkTop=posY=$this.offset().top;linkLeft=$this.offset().left;mouseX=event.pageX;mouseY=event.pageY;if($this[0].tagName.toLowerCase()!='area'){sTop=$(document).scrollTop();winWidth=$(window).width();}
|
||||
if(opts.positionBy=='fixed'){posX=linkWidth+linkLeft+lOffset;$cluetip.css({left:posX});}else{posX=(linkWidth>linkLeft&&linkLeft>tipWidth)||linkLeft+linkWidth+tipWidth+lOffset>winWidth?linkLeft-tipWidth-lOffset:linkWidth+linkLeft+lOffset;if($this[0].tagName.toLowerCase()=='area'||opts.positionBy=='mouse'||linkWidth+tipWidth>winWidth){if(mouseX+20+tipWidth>winWidth){$cluetip.addClass(' cluetip-'+ctClass);posX=(mouseX-tipWidth-lOffset)>=0?mouseX-tipWidth-lOffset-parseInt($cluetip.css('marginLeft'),10)+parseInt($cluetipInner.css('marginRight'),10):mouseX-(tipWidth/2);}else{posX=mouseX+lOffset;}}
|
||||
var pY=posX<0?event.pageY+tOffset:event.pageY;$cluetip.css({left:(posX>0&&opts.positionBy!='bottomTop')?posX:(mouseX+(tipWidth/2)>winWidth)?winWidth/2-tipWidth/2:Math.max(mouseX-(tipWidth/2),0)});}
|
||||
wHeight=$(window).height();if(js){$cluetipInner.html(js);cluetipShow(pY);}
|
||||
else if(tipParts){var tpl=tipParts.length;for(var i=0;i<tpl;i++){if(i==0){$cluetipInner.html(tipParts[i]);}else{$cluetipInner.append('<div class="split-body">'+tipParts[i]+'</div>');}};cluetipShow(pY);}
|
||||
else if(!opts.local&&tipAttribute.indexOf('#')!=0){if(cluetipContents&&opts.ajaxCache){$cluetipInner.html(cluetipContents);cluetipShow(pY);}
|
||||
else{var ajaxSettings=opts.ajaxSettings;ajaxSettings.url=tipAttribute;ajaxSettings.beforeSend=function(){$cluetipOuter.children().empty();if(opts.waitImage){$('#cluetip-waitimage').css({top:mouseY+20,left:mouseX+20}).show();}};ajaxSettings.error=function(){if(isActive){$cluetipInner.html('<i>sorry, the contents could not be loaded</i>');}};ajaxSettings.success=function(data){cluetipContents=opts.ajaxProcess(data);if(isActive){$cluetipInner.html(cluetipContents);}};ajaxSettings.complete=function(){imgCount=$('#cluetip-inner img').length;if(imgCount&&!$.browser.opera){$('#cluetip-inner img').load(function(){imgCount--;if(imgCount<1){$('#cluetip-waitimage').hide();if(isActive)cluetipShow(pY);}});}else{$('#cluetip-waitimage').hide();if(isActive)cluetipShow(pY);}};$.ajax(ajaxSettings);}}else if(opts.local){var $localContent=$(tipAttribute+':first');var localCluetip=$.fn.wrapInner?$localContent.wrapInner('').children().clone(true):$localContent.html();$.fn.wrapInner?$cluetipInner.empty().append(localCluetip):$cluetipInner.html(localCluetip);cluetipShow(pY);}};var cluetipShow=function(bpY){$cluetip.addClass('cluetip-'+ctClass);if(opts.truncate){var $truncloaded=$cluetipInner.text().slice(0,opts.truncate)+'...';$cluetipInner.html($truncloaded);}
|
||||
function doNothing(){};tipTitle?$cluetipTitle.show().html(tipTitle):(opts.showTitle)?$cluetipTitle.show().html(' '):$cluetipTitle.hide();if(opts.sticky){var $closeLink=$('<div id="cluetip-close"><a href="#">'+opts.closeText+'</a></div>');(opts.closePosition=='bottom')?$closeLink.appendTo($cluetipInner):(opts.closePosition=='title')?$closeLink.prependTo($cluetipTitle):$closeLink.prependTo($cluetipInner);$closeLink.click(function(){cluetipClose();return false;});if(opts.mouseOutClose){if($.fn.hoverIntent&&opts.hoverIntent){$cluetip.hoverIntent({over:doNothing,timeout:opts.hoverIntent.timeout,out:function(){$closeLink.trigger('click');}});}else{$cluetip.hover(doNothing,function(){$closeLink.trigger('click');});}}else{$cluetip.unbind('mouseout');}}
|
||||
var direction='';$cluetipOuter.css({overflow:defHeight=='auto'?'visible':'auto',height:defHeight});tipHeight=defHeight=='auto'?Math.max($cluetip.outerHeight(),$cluetip.height()):parseInt(defHeight,10);tipY=posY;baseline=sTop+wHeight;if(opts.positionBy=='fixed'){tipY=posY-opts.dropShadowSteps+tOffset;}else if((posX<mouseX&&Math.max(posX,0)+tipWidth>mouseX)||opts.positionBy=='bottomTop'){if(posY+tipHeight+tOffset>baseline&&mouseY-sTop>tipHeight+tOffset){tipY=mouseY-tipHeight-tOffset;direction='top';}else{tipY=mouseY+tOffset;direction='bottom';}}else if(posY+tipHeight+tOffset>baseline){tipY=(tipHeight>=wHeight)?sTop:baseline-tipHeight-tOffset;}else if($this.css('display')=='block'||$this[0].tagName.toLowerCase()=='area'||opts.positionBy=="mouse"){tipY=bpY-tOffset;}else{tipY=posY-opts.dropShadowSteps;}
|
||||
if(direction==''){posX<linkLeft?direction='left':direction='right';}
|
||||
$cluetip.css({top:tipY+'px'}).removeClass().addClass('clue-'+direction+'-'+ctClass).addClass(' cluetip-'+ctClass);if(opts.arrows){var bgY=(posY-tipY-opts.dropShadowSteps);$cluetipArrows.css({top:(/(left|right)/.test(direction)&&posX>=0&&bgY>0)?bgY+'px':/(left|right)/.test(direction)?0:''}).show();}else{$cluetipArrows.hide();}
|
||||
$dropShadow.hide();$cluetip.hide()[opts.fx.open](opts.fx.open!='show'&&opts.fx.openSpeed);if(opts.dropShadow)$dropShadow.css({height:tipHeight,width:tipInnerWidth}).show();if($.fn.bgiframe){$cluetip.bgiframe();}
|
||||
if(opts.delayedClose>0){closeOnDelay=setTimeout(cluetipClose,opts.delayedClose);}
|
||||
opts.onShow($cluetip,$cluetipInner);};var inactivate=function(){isActive=false;$('#cluetip-waitimage').hide();if(!opts.sticky||(/click|toggle/).test(opts.activation)){cluetipClose();clearTimeout(closeOnDelay);};if(opts.hoverClass){$this.removeClass(opts.hoverClass);}
|
||||
$('.cluetip-clicked').removeClass('cluetip-clicked');};var cluetipClose=function(){$cluetipOuter.parent().hide().removeClass().end().children().empty();if(tipTitle){$this.attr(opts.titleAttribute,tipTitle);}
|
||||
$this.css('cursor','');if(opts.arrows)$cluetipArrows.css({top:''});};if((/click|toggle/).test(opts.activation)){$this.click(function(event){if($cluetip.is(':hidden')||!$this.is('.cluetip-clicked')){activate(event);$('.cluetip-clicked').removeClass('cluetip-clicked');$this.addClass('cluetip-clicked');}else{inactivate(event);}
|
||||
this.blur();return false;});}else if(opts.activation=='focus'){$this.focus(function(event){activate(event);});$this.blur(function(event){inactivate(event);});}else{$this.click(function(){if($this.attr('href')&&$this.attr('href')==tipAttribute&&!opts.clickThrough){return false;}});var mouseTracks=function(evt){if(opts.tracking==true){var trackX=posX-evt.pageX;var trackY=tipY?tipY-evt.pageY:posY-evt.pageY;$this.mousemove(function(evt){$cluetip.css({left:evt.pageX+trackX,top:evt.pageY+trackY});});}};if($.fn.hoverIntent&&opts.hoverIntent){$this.mouseover(function(){$this.attr('title','');}).hoverIntent({sensitivity:opts.hoverIntent.sensitivity,interval:opts.hoverIntent.interval,over:function(event){activate(event);mouseTracks(event);},timeout:opts.hoverIntent.timeout,out:function(event){inactivate(event);$this.unbind('mousemove');}});}else{$this.hover(function(event){activate(event);mouseTracks(event);},function(event){inactivate(event);$this.unbind('mousemove');});}}});};$.fn.cluetip.defaults={width:275,height:'auto',cluezIndex:97,positionBy:'auto',topOffset:15,leftOffset:15,local:false,hideLocal:true,attribute:'rel',titleAttribute:'title',splitTitle:'',showTitle:true,cluetipClass:'default',hoverClass:'',waitImage:true,cursor:'help',arrows:false,dropShadow:true,dropShadowSteps:6,sticky:false,mouseOutClose:false,activation:'hover',clickThrough:false,tracking:false,delayedClose:0,closePosition:'top',closeText:'Close',truncate:0,fx:{open:'show',openSpeed:''},hoverIntent:{sensitivity:3,interval:50,timeout:0},onActivate:function(e){return true;},onShow:function(ct,c){},ajaxCache:true,ajaxProcess:function(data){data=data.replace(/<s(cript|tyle)(.|\s)*?\/s(cript|tyle)>/g,'').replace(/<(link|title)(.|\s)*?\/(link|title)>/g,'');return data;},ajaxSettings:{dataType:'html'},debug:false};var insertionType='appendTo',insertionElement='body';$.cluetip={};$.cluetip.setup=function(options){if(options&&options.insertionType&&(options.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)){insertionType=options.insertionType;}
|
||||
if(options&&options.insertionElement){insertionElement=options.insertionElement;}};})(jQuery);
|
||||
|
After Width: | Height: | Size: 43 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 107 B |
|
After Width: | Height: | Size: 106 B |
|
After Width: | Height: | Size: 347 B |
|
After Width: | Height: | Size: 324 B |
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 352 B |
|
After Width: | Height: | Size: 340 B |
|
After Width: | Height: | Size: 103 B |
|
After Width: | Height: | Size: 503 B |
|
After Width: | Height: | Size: 96 B |
|
After Width: | Height: | Size: 70 B |
|
After Width: | Height: | Size: 506 B |
|
After Width: | Height: | Size: 203 B |
|
After Width: | Height: | Size: 176 B |
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,374 @@
|
||||
/*
|
||||
* FancyBox - jQuery Plugin
|
||||
* Simple and fancy lightbox alternative
|
||||
*
|
||||
* Examples and documentation at: http://fancybox.net
|
||||
*
|
||||
* Copyright (c) 2008 - 2010 Janis Skarnelis
|
||||
* That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
|
||||
*
|
||||
* Version: 1.3.4 (11/11/2010)
|
||||
* Requires: jQuery v1.3+
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
/* PrestaShop
|
||||
*
|
||||
* We did several modifications in this file:
|
||||
*
|
||||
* - Persistant arrows
|
||||
* - Fixed IE 6 path on the AlphaLoader method
|
||||
* - Specific path for background images
|
||||
*
|
||||
*/
|
||||
|
||||
#fancybox-loading {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin-top: -20px;
|
||||
margin-left: -20px;
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
z-index: 1104;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#fancybox-loading div {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 40px;
|
||||
height: 480px;
|
||||
background-image: url('images/fancybox.png');
|
||||
}
|
||||
|
||||
#fancybox-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 1100;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#fancybox-tmp {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
overflow: auto;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#fancybox-wrap {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
padding: 20px;
|
||||
z-index: 1101;
|
||||
outline: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#fancybox-outer {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
#fancybox-content {
|
||||
width: 0;
|
||||
height: 0;
|
||||
padding: 0;
|
||||
outline: none;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
z-index: 1102;
|
||||
border: 0px solid #fff;
|
||||
}
|
||||
|
||||
#fancybox-hide-sel-frame {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: transparent;
|
||||
z-index: 1101;
|
||||
}
|
||||
|
||||
#fancybox-close {
|
||||
position: absolute;
|
||||
top: -15px;
|
||||
right: -15px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
background: transparent url('images/fancybox.png') -40px 0px;
|
||||
cursor: pointer;
|
||||
z-index: 1103;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#fancybox-error {
|
||||
color: #444;
|
||||
font: normal 12px/20px Arial;
|
||||
padding: 14px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#fancybox-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
outline: none;
|
||||
line-height: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#fancybox-frame {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#fancybox-left, #fancybox-right {
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
height: 100%;
|
||||
width: 35%;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
background: transparent url('images/blank.gif');
|
||||
z-index: 1102;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#fancybox-left {
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
#fancybox-right {
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
#fancybox-left-ico, #fancybox-right-ico {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: -9999px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-top: -15px;
|
||||
cursor: pointer;
|
||||
z-index: 1102;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#fancybox-left-ico {
|
||||
background-image: url('images/fancybox.png');
|
||||
background-position: -40px -30px;
|
||||
left: 20px; /* PrestaShop - make left arrow permanently visible */
|
||||
}
|
||||
|
||||
#fancybox-right-ico {
|
||||
background-image: url('images/fancybox.png');
|
||||
background-position: -40px -60px;
|
||||
/* PrestaShop - make right arrow permanently visible */
|
||||
right: 20px;
|
||||
left: auto;
|
||||
/* End */
|
||||
}
|
||||
|
||||
#fancybox-left:hover, #fancybox-right:hover {
|
||||
visibility: visible; /* IE6 */
|
||||
}
|
||||
|
||||
#fancybox-left:hover span {
|
||||
left: 20px;
|
||||
}
|
||||
|
||||
#fancybox-right:hover span {
|
||||
left: auto;
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
.fancybox-bg {
|
||||
position: absolute;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
z-index: 1001;
|
||||
}
|
||||
|
||||
#fancybox-bg-n {
|
||||
top: -20px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background-image: url('images/fancybox-x.png');
|
||||
}
|
||||
|
||||
#fancybox-bg-ne {
|
||||
top: -20px;
|
||||
right: -20px;
|
||||
background-image: url('images/fancybox.png');
|
||||
background-position: -40px -162px;
|
||||
}
|
||||
|
||||
#fancybox-bg-e {
|
||||
top: 0;
|
||||
right: -20px;
|
||||
height: 100%;
|
||||
background-image: url('images/fancybox-y.png');
|
||||
background-position: -20px 0px;
|
||||
}
|
||||
|
||||
#fancybox-bg-se {
|
||||
bottom: -20px;
|
||||
right: -20px;
|
||||
background-image: url('images/fancybox.png');
|
||||
background-position: -40px -182px;
|
||||
}
|
||||
|
||||
#fancybox-bg-s {
|
||||
bottom: -20px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background-image: url('images/fancybox-x.png');
|
||||
background-position: 0px -20px;
|
||||
}
|
||||
|
||||
#fancybox-bg-sw {
|
||||
bottom: -20px;
|
||||
left: -20px;
|
||||
background-image: url('images/fancybox.png');
|
||||
background-position: -40px -142px;
|
||||
}
|
||||
|
||||
#fancybox-bg-w {
|
||||
top: 0;
|
||||
left: -20px;
|
||||
height: 100%;
|
||||
background-image: url('images/fancybox-y.png');
|
||||
}
|
||||
|
||||
#fancybox-bg-nw {
|
||||
top: -20px;
|
||||
left: -20px;
|
||||
background-image: url('images/fancybox.png');
|
||||
background-position: -40px -122px;
|
||||
}
|
||||
|
||||
#fancybox-title {
|
||||
font-family: Helvetica;
|
||||
font-size: 12px;
|
||||
z-index: 1102;
|
||||
}
|
||||
|
||||
.fancybox-title-inside {
|
||||
padding-bottom: 10px;
|
||||
text-align: center;
|
||||
color: #333;
|
||||
background: #fff;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.fancybox-title-outside {
|
||||
padding-top: 10px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.fancybox-title-over {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
color: #FFF;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#fancybox-title-over {
|
||||
padding: 10px;
|
||||
background-image: url('images/fancy_title_over.png');
|
||||
display: block;
|
||||
}
|
||||
|
||||
.fancybox-title-float {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: -20px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
#fancybox-title-float-wrap {
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
#fancybox-title-float-wrap td {
|
||||
border: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#fancybox-title-float-left {
|
||||
padding: 0 0 0 15px;
|
||||
background: url('images/fancybox.png') -40px -90px no-repeat;
|
||||
}
|
||||
|
||||
#fancybox-title-float-main {
|
||||
color: #FFF;
|
||||
line-height: 29px;
|
||||
font-weight: bold;
|
||||
padding: 0 0 3px 0;
|
||||
background: url('images/fancybox-x.png') 0px -40px;
|
||||
}
|
||||
|
||||
#fancybox-title-float-right {
|
||||
padding: 0 0 0 15px;
|
||||
background: url('images/fancybox.png') -55px -90px no-repeat;
|
||||
}
|
||||
|
||||
/* IE6 */
|
||||
|
||||
.fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='imagesfancy_close.png', sizingMethod='scale'); }
|
||||
|
||||
.fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='imagesfancy_nav_left.png', sizingMethod='scale'); }
|
||||
.fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='imagesfancy_nav_right.png', sizingMethod='scale'); }
|
||||
|
||||
.fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='imagesfancy_title_over.png', sizingMethod='scale'); zoom: 1; }
|
||||
.fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='imagesfancy_title_left.png', sizingMethod='scale'); }
|
||||
.fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='imagesfancy_title_main.png', sizingMethod='scale'); }
|
||||
.fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='imagesfancy_title_right.png', sizingMethod='scale'); }
|
||||
|
||||
.fancybox-ie6 #fancybox-bg-w, .fancybox-ie6 #fancybox-bg-e, .fancybox-ie6 #fancybox-left, .fancybox-ie6 #fancybox-right, #fancybox-hide-sel-frame {
|
||||
height: expression(this.parentNode.clientHeight + "px");
|
||||
}
|
||||
|
||||
#fancybox-loading.fancybox-ie6 {
|
||||
position: absolute; margin-top: 0;
|
||||
top: expression( (-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px');
|
||||
}
|
||||
|
||||
#fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='imagesfancy_loading.png', sizingMethod='scale'); }
|
||||
|
||||
/* IE6, IE7, IE8 */
|
||||
|
||||
.fancybox-ie .fancybox-bg { background: transparent !important; }
|
||||
|
||||
.fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_n.png', sizingMethod='scale'); }
|
||||
.fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_ne.png', sizingMethod='scale'); }
|
||||
.fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_e.png', sizingMethod='scale'); }
|
||||
.fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_se.png', sizingMethod='scale'); }
|
||||
.fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_s.png', sizingMethod='scale'); }
|
||||
.fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_sw.png', sizingMethod='scale'); }
|
||||
.fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_w.png', sizingMethod='scale'); }
|
||||
.fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_nw.png', sizingMethod='scale'); }
|
||||
@@ -0,0 +1,127 @@
|
||||
|
||||
div.jGrowl {
|
||||
padding: 10px;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
/** Special IE6 Style Positioning **/
|
||||
div.ie6 {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
div.ie6.top-right {
|
||||
right: auto;
|
||||
bottom: auto;
|
||||
left: expression( ( 0 - jGrowl.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
|
||||
top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
|
||||
}
|
||||
|
||||
div.ie6.top-left {
|
||||
left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
|
||||
top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
|
||||
}
|
||||
|
||||
div.ie6.bottom-right {
|
||||
left: expression( ( 0 - jGrowl.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
|
||||
top: expression( ( 0 - jGrowl.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
|
||||
}
|
||||
|
||||
div.ie6.bottom-left {
|
||||
left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
|
||||
top: expression( ( 0 - jGrowl.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
|
||||
}
|
||||
|
||||
div.ie6.center {
|
||||
left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
|
||||
top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/** Normal Style Positions **/
|
||||
body > div.jGrowl {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
body > div.jGrowl.top-left {
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
body > div.jGrowl.top-right {
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
body > div.jGrowl.bottom-left {
|
||||
left: 0px;
|
||||
bottom: 0px;
|
||||
}
|
||||
|
||||
body > div.jGrowl.bottom-right {
|
||||
right: 0px;
|
||||
bottom: 0px;
|
||||
}
|
||||
|
||||
body > div.jGrowl.center {
|
||||
top: 0px;
|
||||
width: 50%;
|
||||
left: 25%;
|
||||
}
|
||||
|
||||
/** Cross Browser Styling **/
|
||||
div.center div.jGrowl-notification, div.center div.jGrowl-closer {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
div.jGrowl div.jGrowl-notification, div.jGrowl div.jGrowl-closer {
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
opacity: .85;
|
||||
filter: alpha(opacity = 85);
|
||||
zoom: 1;
|
||||
width: 235px;
|
||||
padding: 10px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
font-family: Tahoma, Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
text-align: left;
|
||||
display: none;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
|
||||
div.jGrowl div.jGrowl-notification {
|
||||
min-height: 40px;
|
||||
}
|
||||
|
||||
div.jGrowl div.jGrowl-notification div.header {
|
||||
font-weight: bold;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
div.jGrowl div.jGrowl-notification div.close {
|
||||
z-index: 99;
|
||||
float: right;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div.jGrowl div.jGrowl-closer {
|
||||
height: 15px;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/** Hide jGrowl when printing **/
|
||||
@media print {
|
||||
div.jGrowl {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
(function($){$.jGrowl=function(m,o){if($('#jGrowl').size()==0)$('<div id="jGrowl"></div>').addClass($.jGrowl.defaults.position).appendTo('body');$('#jGrowl').jGrowl(m,o);};$.fn.jGrowl=function(m,o){if($.isFunction(this.each)){var args=arguments;return this.each(function(){var self=this;if($(this).data('jGrowl.instance')==undefined){$(this).data('jGrowl.instance',$.extend(new $.fn.jGrowl(),{notifications:[],element:null,interval:null}));$(this).data('jGrowl.instance').startup(this);}
|
||||
if($.isFunction($(this).data('jGrowl.instance')[m])){$(this).data('jGrowl.instance')[m].apply($(this).data('jGrowl.instance'),$.makeArray(args).slice(1));}else{$(this).data('jGrowl.instance').create(m,o);}});};};$.extend($.fn.jGrowl.prototype,{defaults:{pool:0,header:'',group:'',sticky:false,position:'top-right',glue:'after',theme:'default',corners:'10px',check:250,life:3000,speed:'normal',easing:'swing',closer:true,closeTemplate:'×',closerTemplate:'<div>[ close all ]</div>',log:function(e,m,o){},beforeOpen:function(e,m,o){},open:function(e,m,o){},beforeClose:function(e,m,o){},close:function(e,m,o){},animateOpen:{opacity:'show'},animateClose:{opacity:'hide'}},notifications:[],element:null,interval:null,create:function(message,o){var o=$.extend({},this.defaults,o);this.notifications[this.notifications.length]={message:message,options:o};o.log.apply(this.element,[this.element,message,o]);},render:function(notification){var self=this;var message=notification.message;var o=notification.options;var notification=$('<div class="jGrowl-notification'+((o.group!=undefined&&o.group!='')?' '+o.group:'')+'"><div class="close">'+o.closeTemplate+'</div><div class="header">'+o.header+'</div><div class="message">'+message+'</div></div>').data("jGrowl",o).addClass(o.theme).children('div.close').bind("click.jGrowl",function(){$(this).parent().trigger('jGrowl.close');}).parent();(o.glue=='after')?$('div.jGrowl-notification:last',this.element).after(notification):$('div.jGrowl-notification:first',this.element).before(notification);$(notification).bind("mouseover.jGrowl",function(){$(this).data("jGrowl").pause=true;}).bind("mouseout.jGrowl",function(){$(this).data("jGrowl").pause=false;}).bind('jGrowl.beforeOpen',function(){o.beforeOpen.apply(self.element,[self.element,message,o]);}).bind('jGrowl.open',function(){o.open.apply(self.element,[self.element,message,o]);}).bind('jGrowl.beforeClose',function(){o.beforeClose.apply(self.element,[self.element,message,o]);}).bind('jGrowl.close',function(){$(this).data('jGrowl').pause=true;$(this).trigger('jGrowl.beforeClose').animate(o.animateClose,o.speed,o.easing,function(){$(this).remove();o.close.apply(self.element,[self.element,message,o]);});}).trigger('jGrowl.beforeOpen').animate(o.animateOpen,o.speed,o.easing,function(){$(this).data("jGrowl").created=new Date();}).trigger('jGrowl.open');if($.fn.corner!=undefined)$(notification).corner(o.corners);if($('div.jGrowl-notification:parent',this.element).size()>1&&$('div.jGrowl-closer',this.element).size()==0&&this.defaults.closer!=false){$(this.defaults.closerTemplate).addClass('jGrowl-closer').addClass(this.defaults.theme).appendTo(this.element).animate(this.defaults.animateOpen,this.defaults.speed,this.defaults.easing).bind("click.jGrowl",function(){$(this).siblings().children('div.close').trigger("click.jGrowl");if($.isFunction(self.defaults.closer))self.defaults.closer.apply($(this).parent()[0],[$(this).parent()[0]]);});};},update:function(){$(this.element).find('div.jGrowl-notification:parent').each(function(){if($(this).data("jGrowl")!=undefined&&$(this).data("jGrowl").created!=undefined&&($(this).data("jGrowl").created.getTime()+$(this).data("jGrowl").life)<(new Date()).getTime()&&$(this).data("jGrowl").sticky!=true&&($(this).data("jGrowl").pause==undefined||$(this).data("jGrowl").pause!=true)){$(this).trigger('jGrowl.close');}});if(this.notifications.length>0&&(this.defaults.pool==0||$(this.element).find('div.jGrowl-notification:parent').size()<this.defaults.pool)){this.render(this.notifications.shift());}
|
||||
if($(this.element).find('div.jGrowl-notification:parent').size()<2){$(this.element).find('div.jGrowl-closer').animate(this.defaults.animateClose,this.defaults.speed,this.defaults.easing,function(){$(this).remove();});};},startup:function(e){this.element=$(e).addClass('jGrowl').append('<div class="jGrowl-notification"></div>');this.interval=setInterval(function(){$(e).data('jGrowl.instance').update();},this.defaults.check);if($.browser.msie&&parseInt($.browser.version)<7&&!window["XMLHttpRequest"])$(this.element).addClass('ie6');},shutdown:function(){$(this.element).removeClass('jGrowl').find('div.jGrowl-notification').remove();clearInterval(this.interval);}});$.jGrowl.defaults=$.fn.jGrowl.prototype.defaults;})(jQuery);
|
||||
@@ -0,0 +1,563 @@
|
||||
/*
|
||||
mColorPicker
|
||||
Version: 1.0 r34
|
||||
|
||||
Copyright (c) 2010 Meta100 LLC.
|
||||
http://www.meta100.com/
|
||||
|
||||
Licensed under the MIT license
|
||||
http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
// After this script loads set:
|
||||
// $.fn.mColorPicker.init.replace = '.myclass'
|
||||
// to have this script apply to input.myclass,
|
||||
// instead of the default input[type=color]
|
||||
// To turn of automatic operation and run manually set:
|
||||
// $.fn.mColorPicker.init.replace = false
|
||||
// To use manually call like any other jQuery plugin
|
||||
// $('input.foo').mColorPicker({options})
|
||||
// options:
|
||||
// imageFolder - Change to move image location.
|
||||
// swatches - Initial colors in the swatch, must an array of 10 colors.
|
||||
// init:
|
||||
// $.fn.mColorPicker.init.enhancedSwatches - Turn of saving and loading of swatch to cookies.
|
||||
// $.fn.mColorPicker.init.allowTransparency - Turn off transperancy as a color option.
|
||||
// $.fn.mColorPicker.init.showLogo - Turn on/off the meta100 logo (You don't really want to turn it off, do you?).
|
||||
|
||||
(function($){
|
||||
|
||||
var $o;
|
||||
|
||||
$.fn.mColorPicker = function(options) {
|
||||
|
||||
$o = $.extend($.fn.mColorPicker.defaults, options);
|
||||
|
||||
if ($o.swatches.length < 10) $o.swatches = $.fn.mColorPicker.defaults.swatches
|
||||
if ($("div#mColorPicker").length < 1) $.fn.mColorPicker.drawPicker();
|
||||
|
||||
if ($('#css_disabled_color_picker').length < 1) $('head').prepend('<style id="css_disabled_color_picker" type="text/css">.mColorPicker[disabled] + span, .mColorPicker[disabled="disabled"] + span, .mColorPicker[disabled="true"] + span {filter:alpha(opacity=50);-moz-opacity:0.5;-webkit-opacity:0.5;-khtml-opacity: 0.5;opacity: 0.5;}</style>');
|
||||
|
||||
$('.mColorPicker').live('keyup', function () {
|
||||
|
||||
try {
|
||||
|
||||
$(this).css({
|
||||
'background-color': $(this).val()
|
||||
}).css({
|
||||
'color': $.fn.mColorPicker.textColor($(this).css('background-color'))
|
||||
}).trigger('change');
|
||||
} catch (r) {}
|
||||
});
|
||||
|
||||
$('.mColorPickerTrigger').live('click', function () {
|
||||
|
||||
$.fn.mColorPicker.colorShow($(this).attr('id').replace('icp_', ''));
|
||||
});
|
||||
|
||||
this.each(function () {
|
||||
|
||||
$.fn.mColorPicker.drawPickerTriggers($(this));
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.currentColor = false;
|
||||
$.fn.mColorPicker.currentValue = false;
|
||||
$.fn.mColorPicker.color = false;
|
||||
|
||||
$.fn.mColorPicker.init = {
|
||||
replace: '[type=color]',
|
||||
index: 0,
|
||||
enhancedSwatches: true,
|
||||
allowTransparency: false,
|
||||
checkRedraw: 'DOMUpdated', // Change to 'ajaxSuccess' for ajax only or false if not needed
|
||||
liveEvents: false,
|
||||
showLogo: false
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.defaults = {
|
||||
imageFolder: '../img/admin/',
|
||||
swatches: [
|
||||
"#ffffff",
|
||||
"#ffff00",
|
||||
"#00ff00",
|
||||
"#00ffff",
|
||||
"#0000ff",
|
||||
"#ff00ff",
|
||||
"#ff0000",
|
||||
"#4c2b11",
|
||||
"#3b3b3b",
|
||||
"#000000"
|
||||
]
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.liveEvents = function() {
|
||||
|
||||
$.fn.mColorPicker.init.liveEvents = true;
|
||||
|
||||
if ($.fn.mColorPicker.init.checkRedraw && $.fn.mColorPicker.init.replace) {
|
||||
|
||||
$(document).bind($.fn.mColorPicker.init.checkRedraw + '.mColorPicker', function () {
|
||||
|
||||
$('input[data-mcolorpicker!="true"]').filter(function() {
|
||||
|
||||
return ($.fn.mColorPicker.init.replace == '[type=color]')? this.getAttribute("type") == 'color': $(this).is($.fn.mColorPicker.init.replace);
|
||||
}).mColorPicker();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.drawPickerTriggers = function ($t) {
|
||||
|
||||
if ($t[0].nodeName.toLowerCase() != 'input') return false;
|
||||
|
||||
var id = $t.attr('id') || 'color_' + $.fn.mColorPicker.init.index++,
|
||||
hidden = false;
|
||||
|
||||
$t.attr('id', id);
|
||||
|
||||
if ($t.attr('text') == 'hidden' || $t.attr('data-text') == 'hidden') hidden = true;
|
||||
|
||||
var color = $t.val(),
|
||||
width = ($t.width() > 0)? $t.width(): parseInt($t.css('width'), 10),
|
||||
height = ($t.height())? $t.height(): parseInt($t.css('height'), 10),
|
||||
flt = $t.css('float'),
|
||||
image = (color == 'transparent')? "url('" + $o.imageFolder + "/grid.gif')": '',
|
||||
colorPicker = '';
|
||||
|
||||
$('body').append('<span id="color_work_area"></span>');
|
||||
$('span#color_work_area').append($t.clone(true));
|
||||
colorPicker = $('span#color_work_area').html().replace(/type="color"/gi, '').replace(/input /gi, (hidden)? 'input type="hidden"': 'input type="text"');
|
||||
$('span#color_work_area').html('').remove();
|
||||
$t.after(
|
||||
(hidden)? '<span style="cursor:pointer;border:1px solid black;float:' + flt + ';width:' + width + 'px;height:' + height + 'px;" id="icp_' + id + '"> </span>': ''
|
||||
).after(colorPicker).remove();
|
||||
|
||||
if (hidden) {
|
||||
|
||||
$('#icp_' + id).css({
|
||||
'background-color': color,
|
||||
'background-image': image,
|
||||
'display': 'inline-block'
|
||||
}).attr(
|
||||
'class', $('#' + id).attr('class')
|
||||
).addClass(
|
||||
'mColorPickerTrigger'
|
||||
);
|
||||
} else {
|
||||
|
||||
$('#' + id).css({
|
||||
'background-color': color,
|
||||
'background-image': image
|
||||
}).css({
|
||||
'color': $.fn.mColorPicker.textColor($('#' + id).css('background-color'))
|
||||
}).after(
|
||||
'<span style="cursor:pointer;" id="icp_' + id + '" class="mColorPickerTrigger"><img src="' + $o.imageFolder + 'color.png" style="border:0;margin:0 0 0 3px" align="absmiddle"></span>'
|
||||
).addClass('mColorPickerInput');
|
||||
}
|
||||
|
||||
$('#icp_' + id).attr('data-mcolorpicker', 'true');
|
||||
|
||||
$('#' + id).addClass('mColorPicker');
|
||||
|
||||
return $('#' + id);
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.drawPicker = function () {
|
||||
|
||||
$(document.createElement("div")).attr(
|
||||
"id","mColorPicker"
|
||||
).css(
|
||||
'display','none'
|
||||
).html(
|
||||
'<div id="mColorPickerWrapper"><div id="mColorPickerImg" class="mColor"></div><div id="mColorPickerImgGray" class="mColor"></div><div id="mColorPickerSwatches"><div class="mClear"></div></div><div id="mColorPickerFooter"><input type="text" size="8" id="mColorPickerInput"/></div></div>'
|
||||
).appendTo("body");
|
||||
|
||||
$(document.createElement("div")).attr("id","mColorPickerBg").css({
|
||||
'display': 'none'
|
||||
}).appendTo("body");
|
||||
|
||||
for (n = 9; n > -1; n--) {
|
||||
|
||||
$(document.createElement("div")).attr({
|
||||
'id': 'cell' + n,
|
||||
'class': "mPastColor" + ((n > 0)? ' mNoLeftBorder': '')
|
||||
}).html(
|
||||
' '
|
||||
).prependTo("#mColorPickerSwatches");
|
||||
}
|
||||
|
||||
$('#mColorPicker').css({
|
||||
'border':'1px solid #ccc',
|
||||
'color':'#fff',
|
||||
'z-index':999998,
|
||||
'width':'194px',
|
||||
'height':'184px',
|
||||
'font-size':'12px',
|
||||
'font-family':'times'
|
||||
});
|
||||
|
||||
$('.mPastColor').css({
|
||||
'height':'18px',
|
||||
'width':'18px',
|
||||
'border':'1px solid #000',
|
||||
'float':'left'
|
||||
});
|
||||
|
||||
$('#colorPreview').css({
|
||||
'height':'50px'
|
||||
});
|
||||
|
||||
$('.mNoLeftBorder').css({
|
||||
'border-left':0
|
||||
});
|
||||
|
||||
$('.mClear').css({
|
||||
'clear':'both'
|
||||
});
|
||||
|
||||
$('#mColorPickerWrapper').css({
|
||||
'position':'relative',
|
||||
'border':'solid 1px gray',
|
||||
'z-index':999999
|
||||
});
|
||||
|
||||
$('#mColorPickerImg').css({
|
||||
'height':'128px',
|
||||
'width':'192px',
|
||||
'border':0,
|
||||
'cursor':'crosshair',
|
||||
'background-image':"url('" + $o.imageFolder + "colorpicker.png')"
|
||||
});
|
||||
|
||||
$('#mColorPickerImgGray').css({
|
||||
'height':'8px',
|
||||
'width':'192px',
|
||||
'border':0,
|
||||
'cursor':'crosshair',
|
||||
'background-image':"url('" + $o.imageFolder + "graybar.jpg')"
|
||||
});
|
||||
|
||||
$('#mColorPickerInput').css({
|
||||
'border':'solid 1px gray',
|
||||
'font-size':'10pt',
|
||||
'margin':'3px',
|
||||
'width':'80px'
|
||||
});
|
||||
|
||||
$('#mColorPickerImgGrid').css({
|
||||
'border':0,
|
||||
'height':'20px',
|
||||
'width':'20px',
|
||||
'vertical-align':'text-bottom'
|
||||
});
|
||||
|
||||
$('#mColorPickerSwatches').css({
|
||||
'border-right':'1px solid #000'
|
||||
});
|
||||
|
||||
$('#mColorPickerFooter').css({
|
||||
'background-image':"url('" + $o.imageFolder + "grid.gif')",
|
||||
'position': 'relative',
|
||||
'height':'26px'
|
||||
});
|
||||
|
||||
if ($.fn.mColorPicker.init.allowTransparency) $('#mColorPickerFooter').prepend('<span id="mColorPickerTransparent" class="mColor" style="font-size:16px;color:#000;padding-right:30px;padding-top:3px;cursor:pointer;overflow:hidden;float:right;">transparent</span>');
|
||||
if ($.fn.mColorPicker.init.showLogo) $('#mColorPickerFooter').prepend('<a href="http://meta100.com/" title="Meta100 - Designing Fun" alt="Meta100 - Designing Fun" style="float:right;" target="_blank"><img src="' + $o.imageFolder + 'meta100.png" title="Meta100 - Designing Fun" alt="Meta100 - Designing Fun" style="border:0;border-left:1px solid #aaa;right:0;position:absolute;"/></a>');
|
||||
|
||||
$("#mColorPickerBg").click($.fn.mColorPicker.closePicker);
|
||||
|
||||
var swatch = $.fn.mColorPicker.getCookie('swatches'),
|
||||
i = 0;
|
||||
|
||||
if (typeof swatch == 'string') swatch = swatch.split('||');
|
||||
if (swatch == null || $.fn.mColorPicker.init.enhancedSwatches || swatch.length < 10) swatch = $o.swatches;
|
||||
|
||||
$(".mPastColor").each(function() {
|
||||
|
||||
$(this).css('background-color', swatch[i++].toLowerCase());
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.closePicker = function () {
|
||||
|
||||
$(".mColor, .mPastColor, #mColorPickerInput, #mColorPickerWrapper").unbind();
|
||||
$("#mColorPickerBg").hide();
|
||||
$("#mColorPicker").fadeOut()
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.colorShow = function (id) {
|
||||
|
||||
var $e = $("#icp_" + id);
|
||||
pos = $e.offset(),
|
||||
$i = $("#" + id);
|
||||
hex = $i.attr('data-hex') || $i.attr('hex'),
|
||||
pickerTop = pos.top + $e.outerHeight(),
|
||||
pickerLeft = pos.left,
|
||||
$d = $(document),
|
||||
$m = $("#mColorPicker");
|
||||
|
||||
if ($i.attr('disabled')) return false;
|
||||
|
||||
// KEEP COLOR PICKER IN VIEWPORT
|
||||
if (pickerTop + $m.height() > $d.height()) pickerTop = pos.top - $m.height();
|
||||
if (pickerLeft + $m.width() > $d.width()) pickerLeft = pos.left - $m.width() + $e.outerWidth();
|
||||
|
||||
$m.css({
|
||||
'top':(pickerTop) + "px",
|
||||
'left':(pickerLeft) + "px",
|
||||
'position':'absolute'
|
||||
}).fadeIn("fast");
|
||||
|
||||
$("#mColorPickerBg").css({
|
||||
'z-index':999990,
|
||||
'background':'black',
|
||||
'opacity': .01,
|
||||
'position':'absolute',
|
||||
'top':0,
|
||||
'left':0,
|
||||
'width': parseInt($d.width(), 10) + 'px',
|
||||
'height': parseInt($d.height(), 10) + 'px'
|
||||
}).show();
|
||||
|
||||
var def = $i.val();
|
||||
|
||||
$('#colorPreview span').text(def);
|
||||
$('#colorPreview').css('background', def);
|
||||
$('#color').val(def);
|
||||
|
||||
if ($('#' + id).attr('data-text')) $.fn.mColorPicker.currentColor = $e.css('background-color');
|
||||
else $.fn.mColorPicker.currentColor = $i.css('background-color');
|
||||
|
||||
if (hex == 'true') $.fn.mColorPicker.currentColor = $.fn.mColorPicker.RGBtoHex($.fn.mColorPicker.currentColor);
|
||||
|
||||
$("#mColorPickerInput").val($.fn.mColorPicker.currentColor);
|
||||
|
||||
$('.mColor, .mPastColor').bind('mousemove', function(e) {
|
||||
|
||||
var offset = $(this).offset();
|
||||
|
||||
$.fn.mColorPicker.color = $(this).css("background-color");
|
||||
|
||||
if ($(this).hasClass('mPastColor') && hex == 'true') $.fn.mColorPicker.color = $.fn.mColorPicker.RGBtoHex($.fn.mColorPicker.color);
|
||||
else if ($(this).hasClass('mPastColor') && hex != 'true') $.fn.mColorPicker.color = $.fn.mColorPicker.hexToRGB($.fn.mColorPicker.color);
|
||||
else if ($(this).attr('id') == 'mColorPickerTransparent') $.fn.mColorPicker.color = 'transparent';
|
||||
else if (!$(this).hasClass('mPastColor')) $.fn.mColorPicker.color = $.fn.mColorPicker.whichColor(e.pageX - offset.left, e.pageY - offset.top + (($(this).attr('id') == 'mColorPickerImgGray')? 128: 0), hex);
|
||||
|
||||
$.fn.mColorPicker.setInputColor(id, $.fn.mColorPicker.color);
|
||||
}).click(function() {
|
||||
|
||||
$.fn.mColorPicker.colorPicked(id);
|
||||
});
|
||||
|
||||
$('#mColorPickerInput').bind('keyup', function (e) {
|
||||
|
||||
try {
|
||||
|
||||
$.fn.mColorPicker.color = $('#mColorPickerInput').val();
|
||||
$.fn.mColorPicker.setInputColor(id, $.fn.mColorPicker.color);
|
||||
|
||||
if (e.which == 13) $.fn.mColorPicker.colorPicked(id);
|
||||
} catch (r) {}
|
||||
|
||||
}).bind('blur', function () {
|
||||
|
||||
$.fn.mColorPicker.setInputColor(id, $.fn.mColorPicker.currentColor);
|
||||
});
|
||||
|
||||
$('#mColorPickerWrapper').bind('mouseleave', function () {
|
||||
|
||||
$.fn.mColorPicker.setInputColor(id, $.fn.mColorPicker.currentColor);
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.setInputColor = function (id, color) {
|
||||
|
||||
var image = (color == 'transparent')? "url('" + $o.imageFolder + "grid.gif')": '',
|
||||
textColor = $.fn.mColorPicker.textColor(color);
|
||||
|
||||
if ($('#' + id).attr('data-text') || $('#' + id).attr('text')) $("#icp_" + id).css({'background-color': color, 'background-image': image});
|
||||
$("#" + id).val(color).css({'background-color': color, 'background-image': image, 'color' : textColor}).trigger('change');
|
||||
$("#mColorPickerInput").val(color);
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.textColor = function (val) {
|
||||
|
||||
if (typeof val == 'undefined' || val == 'transparent') return "black";
|
||||
val = $.fn.mColorPicker.RGBtoHex(val);
|
||||
return (parseInt(val.substr(1, 2), 16) + parseInt(val.substr(3, 2), 16) + parseInt(val.substr(5, 2), 16) < 400)? 'white': 'black';
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.setCookie = function (name, value, days) {
|
||||
|
||||
var cookie_string = name + "=" + escape(value),
|
||||
expires = new Date();
|
||||
expires.setDate(expires.getDate() + days);
|
||||
cookie_string += "; expires=" + expires.toGMTString();
|
||||
|
||||
document.cookie = cookie_string;
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.getCookie = function (name) {
|
||||
|
||||
var results = document.cookie.match ( '(^|;) ?' + name + '=([^;]*)(;|$)' );
|
||||
|
||||
if (results) return (unescape(results[2]));
|
||||
else return null;
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.colorPicked = function (id) {
|
||||
|
||||
$.fn.mColorPicker.closePicker();
|
||||
|
||||
if ($.fn.mColorPicker.init.enhancedSwatches) $.fn.mColorPicker.addToSwatch();
|
||||
|
||||
$("#" + id).trigger('colorpicked');
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.addToSwatch = function (color) {
|
||||
|
||||
var swatch = []
|
||||
i = 0;
|
||||
|
||||
if (typeof color == 'string') $.fn.mColorPicker.color = color.toLowerCase();
|
||||
|
||||
$.fn.mColorPicker.currentValue = $.fn.mColorPicker.currentColor = $.fn.mColorPicker.color;
|
||||
|
||||
if ($.fn.mColorPicker.color != 'transparent') swatch[0] = $.fn.mColorPicker.color.toLowerCase();
|
||||
|
||||
$('.mPastColor').each(function() {
|
||||
|
||||
$.fn.mColorPicker.color = $(this).css('background-color').toLowerCase();
|
||||
|
||||
if ($.fn.mColorPicker.color != swatch[0] && $.fn.mColorPicker.RGBtoHex($.fn.mColorPicker.color) != swatch[0] && $.fn.mColorPicker.hexToRGB($.fn.mColorPicker.color) != swatch[0] && swatch.length < 10) swatch[swatch.length] = $.fn.mColorPicker.color;
|
||||
|
||||
$(this).css('background-color', swatch[i++])
|
||||
});
|
||||
|
||||
if ($.fn.mColorPicker.init.enhancedSwatches) $.fn.mColorPicker.setCookie('swatches', swatch.join('||'), 365);
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.whichColor = function (x, y, hex) {
|
||||
|
||||
var colorR = colorG = colorB = 255;
|
||||
|
||||
if (x < 32) {
|
||||
|
||||
colorG = x * 8;
|
||||
colorB = 0;
|
||||
} else if (x < 64) {
|
||||
|
||||
colorR = 256 - (x - 32 ) * 8;
|
||||
colorB = 0;
|
||||
} else if (x < 96) {
|
||||
|
||||
colorR = 0;
|
||||
colorB = (x - 64) * 8;
|
||||
} else if (x < 128) {
|
||||
|
||||
colorR = 0;
|
||||
colorG = 256 - (x - 96) * 8;
|
||||
} else if (x < 160) {
|
||||
|
||||
colorR = (x - 128) * 8;
|
||||
colorG = 0;
|
||||
} else {
|
||||
|
||||
colorG = 0;
|
||||
colorB = 256 - (x - 160) * 8;
|
||||
}
|
||||
|
||||
if (y < 64) {
|
||||
|
||||
colorR += (256 - colorR) * (64 - y) / 64;
|
||||
colorG += (256 - colorG) * (64 - y) / 64;
|
||||
colorB += (256 - colorB) * (64 - y) / 64;
|
||||
} else if (y <= 128) {
|
||||
|
||||
colorR -= colorR * (y - 64) / 64;
|
||||
colorG -= colorG * (y - 64) / 64;
|
||||
colorB -= colorB * (y - 64) / 64;
|
||||
} else if (y > 128) {
|
||||
|
||||
colorR = colorG = colorB = 256 - ( x / 192 * 256 );
|
||||
}
|
||||
|
||||
colorR = Math.round(Math.min(colorR, 255));
|
||||
colorG = Math.round(Math.min(colorG, 255));
|
||||
colorB = Math.round(Math.min(colorB, 255));
|
||||
|
||||
if (hex == 'true') {
|
||||
|
||||
colorR = colorR.toString(16);
|
||||
colorG = colorG.toString(16);
|
||||
colorB = colorB.toString(16);
|
||||
|
||||
if (colorR.length < 2) colorR = 0 + colorR;
|
||||
if (colorG.length < 2) colorG = 0 + colorG;
|
||||
if (colorB.length < 2) colorB = 0 + colorB;
|
||||
|
||||
return "#" + colorR + colorG + colorB;
|
||||
}
|
||||
|
||||
return "rgb(" + colorR + ', ' + colorG + ', ' + colorB + ')';
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.RGBtoHex = function (color) {
|
||||
|
||||
color = color.toLowerCase();
|
||||
|
||||
if (typeof color == 'undefined') return '';
|
||||
if (color.indexOf('#') > -1 && color.length > 6) return color;
|
||||
if (color.indexOf('rgb') < 0) return color;
|
||||
|
||||
if (color.indexOf('#') > -1) {
|
||||
|
||||
return '#' + color.substr(1, 1) + color.substr(1, 1) + color.substr(2, 1) + color.substr(2, 1) + color.substr(3, 1) + color.substr(3, 1);
|
||||
}
|
||||
|
||||
var hexArray = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"],
|
||||
decToHex = "#",
|
||||
code1 = 0;
|
||||
|
||||
color = color.replace(/[^0-9,]/g, '').split(",");
|
||||
|
||||
for (var n = 0; n < color.length; n++) {
|
||||
|
||||
code1 = Math.floor(color[n] / 16);
|
||||
decToHex += hexArray[code1] + hexArray[color[n] - code1 * 16];
|
||||
}
|
||||
|
||||
return decToHex;
|
||||
};
|
||||
|
||||
$.fn.mColorPicker.hexToRGB = function (color) {
|
||||
|
||||
color = color.toLowerCase();
|
||||
|
||||
if (typeof color == 'undefined') return '';
|
||||
if (color.indexOf('rgb') > -1) return color;
|
||||
if (color.indexOf('#') < 0) return color;
|
||||
|
||||
var c = color.replace('#', '');
|
||||
|
||||
if (c.length < 6) c = c.substr(0, 1) + c.substr(0, 1) + c.substr(1, 1) + c.substr(1, 1) + c.substr(2, 1) + c.substr(2, 1);
|
||||
|
||||
return 'rgb(' + parseInt(c.substr(0, 2), 16) + ', ' + parseInt(c.substr(2, 2), 16) + ', ' + parseInt(c.substr(4, 2), 16) + ')';
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
if ($.fn.mColorPicker.init.replace) {
|
||||
|
||||
$('input[data-mcolorpicker!="true"]').filter(function() {
|
||||
|
||||
return ($.fn.mColorPicker.init.replace == '[type=color]')? this.getAttribute("type") == 'color': $(this).is($.fn.mColorPicker.init.replace);
|
||||
}).mColorPicker();
|
||||
|
||||
$.fn.mColorPicker.liveEvents();
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,12 @@
|
||||
/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
*
|
||||
* $LastChangedDate: 2011-06-03 16:46:51 +0200 (ven. 03 juin 2011) $
|
||||
* $Rev: 6844 $
|
||||
*
|
||||
* Version: 1.2
|
||||
*
|
||||
* Requires: jQuery 1.2+
|
||||
*/
|
||||
(function($){$.dimensions={version:'1.2'};$.each(['Height','Width'],function(i,name){$.fn['inner'+name]=function(){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';return this.is(':visible')?this[0]['client'+name]:num(this,name.toLowerCase())+num(this,'padding'+torl)+num(this,'padding'+borr);};$.fn['outer'+name]=function(options){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';options=$.extend({margin:false},options||{});var val=this.is(':visible')?this[0]['offset'+name]:num(this,name.toLowerCase())+num(this,'border'+torl+'Width')+num(this,'border'+borr+'Width')+num(this,'padding'+torl)+num(this,'padding'+borr);return val+(options.margin?(num(this,'margin'+torl)+num(this,'margin'+borr)):0);};});$.each(['Left','Top'],function(i,name){$.fn['scroll'+name]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(name=='Left'?val:$(window)['scrollLeft'](),name=='Top'?val:$(window)['scrollTop']()):this['scroll'+name]=val;}):this[0]==window||this[0]==document?self[(name=='Left'?'pageXOffset':'pageYOffset')]||$.boxModel&&document.documentElement['scroll'+name]||document.body['scroll'+name]:this[0]['scroll'+name];};});$.fn.extend({position:function(){var left=0,top=0,elem=this[0],offset,parentOffset,offsetParent,results;if(elem){offsetParent=this.offsetParent();offset=this.offset();parentOffset=offsetParent.offset();offset.top-=num(elem,'marginTop');offset.left-=num(elem,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&$.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return $(offsetParent);}});function num(el,prop){return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;};})(jQuery);
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
||||
*
|
||||
* Uses the built In easIng capabilities added In jQuery 1.1
|
||||
* to offer multiple easIng options
|
||||
*
|
||||
* Copyright (c) 2007 George Smith
|
||||
* Licensed under the MIT License:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
// t: current time, b: begInnIng value, c: change In value, d: duration
|
||||
jQuery.easing['jswing'] = jQuery.easing['swing'];
|
||||
|
||||
jQuery.extend( jQuery.easing,
|
||||
{
|
||||
def: 'easeOutQuad',
|
||||
swing: function (x, t, b, c, d) {
|
||||
//alert(jQuery.easing.default);
|
||||
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
|
||||
},
|
||||
easeInQuad: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t + b;
|
||||
},
|
||||
easeOutQuad: function (x, t, b, c, d) {
|
||||
return -c *(t/=d)*(t-2) + b;
|
||||
},
|
||||
easeInOutQuad: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t + b;
|
||||
return -c/2 * ((--t)*(t-2) - 1) + b;
|
||||
},
|
||||
easeInCubic: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t + b;
|
||||
},
|
||||
easeOutCubic: function (x, t, b, c, d) {
|
||||
return c*((t=t/d-1)*t*t + 1) + b;
|
||||
},
|
||||
easeInOutCubic: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
||||
return c/2*((t-=2)*t*t + 2) + b;
|
||||
},
|
||||
easeInQuart: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t*t + b;
|
||||
},
|
||||
easeOutQuart: function (x, t, b, c, d) {
|
||||
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
||||
},
|
||||
easeInOutQuart: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
||||
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
||||
},
|
||||
easeInQuint: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t*t*t + b;
|
||||
},
|
||||
easeOutQuint: function (x, t, b, c, d) {
|
||||
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
||||
},
|
||||
easeInOutQuint: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
||||
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
||||
},
|
||||
easeInSine: function (x, t, b, c, d) {
|
||||
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
||||
},
|
||||
easeOutSine: function (x, t, b, c, d) {
|
||||
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
||||
},
|
||||
easeInOutSine: function (x, t, b, c, d) {
|
||||
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
||||
},
|
||||
easeInExpo: function (x, t, b, c, d) {
|
||||
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
||||
},
|
||||
easeOutExpo: function (x, t, b, c, d) {
|
||||
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
||||
},
|
||||
easeInOutExpo: function (x, t, b, c, d) {
|
||||
if (t==0) return b;
|
||||
if (t==d) return b+c;
|
||||
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
||||
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
||||
},
|
||||
easeInCirc: function (x, t, b, c, d) {
|
||||
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
||||
},
|
||||
easeOutCirc: function (x, t, b, c, d) {
|
||||
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
||||
},
|
||||
easeInOutCirc: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
||||
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
||||
},
|
||||
easeInElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
||||
},
|
||||
easeOutElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
||||
},
|
||||
easeInOutElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
||||
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
||||
},
|
||||
easeInBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
return c*(t/=d)*t*((s+1)*t - s) + b;
|
||||
},
|
||||
easeOutBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
||||
},
|
||||
easeInOutBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
||||
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
||||
},
|
||||
easeInBounce: function (x, t, b, c, d) {
|
||||
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
||||
},
|
||||
easeOutBounce: function (x, t, b, c, d) {
|
||||
if ((t/=d) < (1/2.75)) {
|
||||
return c*(7.5625*t*t) + b;
|
||||
} else if (t < (2/2.75)) {
|
||||
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
||||
} else if (t < (2.5/2.75)) {
|
||||
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
||||
} else {
|
||||
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
||||
}
|
||||
},
|
||||
easeInOutBounce: function (x, t, b, c, d) {
|
||||
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
||||
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* jQuery plugin: fieldSelection - v0.1.0 - last change: 2006-12-16
|
||||
* (c) 2006 Alex Brem <alex@0xab.cd> - http://blog.0xab.cd
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var fieldSelection = {
|
||||
|
||||
getSelection: function() {
|
||||
|
||||
var e = this.jquery ? this[0] : this;
|
||||
|
||||
return (
|
||||
|
||||
/* mozilla / dom 3.0 */
|
||||
('selectionStart' in e && function() {
|
||||
var l = e.selectionEnd - e.selectionStart;
|
||||
console.log(e);
|
||||
return { start: e.selectionStart, end: e.selectionEnd, length: l, text: e.value.substr(e.selectionStart, l) };
|
||||
}) ||
|
||||
|
||||
/* exploder */
|
||||
(document.selection && function() {
|
||||
|
||||
e.focus();
|
||||
|
||||
var r = document.selection.createRange();
|
||||
if (r == null) {
|
||||
return { start: 0, end: e.value.length, length: 0 }
|
||||
}
|
||||
|
||||
var re = e.createTextRange();
|
||||
var rc = re.duplicate();
|
||||
re.moveToBookmark(r.getBookmark());
|
||||
rc.setEndPoint('EndToStart', re);
|
||||
|
||||
return { start: rc.text.length, end: rc.text.length + r.text.length, length: r.text.length, text: r.text };
|
||||
}) ||
|
||||
|
||||
/* browser not supported */
|
||||
function() {
|
||||
return { start: 0, end: e.value.length, length: 0 };
|
||||
}
|
||||
|
||||
)();
|
||||
|
||||
},
|
||||
|
||||
replaceSelection: function() {
|
||||
|
||||
var e = this.jquery ? this[0] : this;
|
||||
var text = arguments[0] || '';
|
||||
|
||||
return (
|
||||
|
||||
/* mozilla / dom 3.0 */
|
||||
('selectionStart' in e && function() {
|
||||
e.value = e.value.substr(0, e.selectionStart) + text + e.value.substr(e.selectionEnd, e.value.length);
|
||||
return this;
|
||||
}) ||
|
||||
|
||||
/* exploder */
|
||||
(document.selection && function() {
|
||||
e.focus();
|
||||
document.selection.createRange().text = text;
|
||||
return this;
|
||||
}) ||
|
||||
|
||||
/* browser not supported */
|
||||
function() {
|
||||
e.value += text;
|
||||
return this;
|
||||
}
|
||||
|
||||
)();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
jQuery.each(fieldSelection, function(i) { jQuery.fn[i] = this; });
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
|
||||
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
|
||||
*
|
||||
* @param f onMouseOver function || An object with configuration options
|
||||
* @param g onMouseOut function || Nothing (use configuration options object)
|
||||
* @author Brian Cherne <brian@cherne.net>
|
||||
*/
|
||||
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);
|
||||
@@ -0,0 +1,34 @@
|
||||
/* idTabs ~ Sean Catchpole - Version 1.0 */
|
||||
|
||||
/* Options (in any order):
|
||||
|
||||
start (number|string)
|
||||
Index number of default tab. ex: idTabs(0)
|
||||
String of id of default tab. ex: idTabs("#tab1")
|
||||
default: class "selected" or index 0
|
||||
|
||||
return (boolean)
|
||||
True - Url will change. ex: idTabs(true)
|
||||
False - Url will not change. ex: idTabs(false)
|
||||
default: false
|
||||
|
||||
click (function)
|
||||
Function will be called when a tab is clicked. ex: idTabs(foo)
|
||||
If the function returns true, idTabs will show/hide content (as usual).
|
||||
If the function returns false, idTabs will not take any action.
|
||||
The function is passed three variables:
|
||||
The id of the element to be shown
|
||||
an array of all id's that can be shown
|
||||
and the element containing the tabs
|
||||
|
||||
MODIFIED BY PRESTASHOP
|
||||
|
||||
*/
|
||||
|
||||
(function($){$.fn.idTabs=function(){var s={"start":null,"return":false,"click":null};for(var i=0;i<arguments.length;++i){var n={},a=arguments[i];switch(typeof a){case"object":$.extend(n,a);break;case"number":case"string":n.start=a;break;case"boolean":n["return"]=a;break;case"function":n.click=a;break;};$.extend(s,n);}
|
||||
var self=this;var list=$("a[href^='#']",this).click(function(){if($("a.selected",self)[0]==this)
|
||||
return s["return"];var id="#"+this.href.split('#')[1];var aList=[];var idList=[];$("a",self).each(function(){if(this.href.match(/#/)){aList[aList.length]=this;idList[idList.length]="#"+this.href.split('#')[1];}});if(s.click&&!s.click(id,idList,self))return s["return"];for(i in aList)$(aList[i]).removeClass("selected");for(i in idList){$(idList[i]).addClass('block_hidden_only_for_screen');}
|
||||
$(this).addClass("selected");$(id).removeClass('block_hidden_only_for_screen');return s["return"];});var test;if(typeof s.start=="number"&&(test=list.filter(":eq("+s.start+")")).length)
|
||||
test.click();else if(typeof s.start=="string"&&(test=list.filter("[href='#"+s.start+"']")).length)
|
||||
test.click();else if((test=list.filter(".selected")).length)
|
||||
test.removeClass("selected").click();else list.filter(":first").click();return this;};$(function(){$(".idTabs").each(function(){$(this).idTabs();});});})(jQuery)
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Interface Elements for jQuery
|
||||
* FX - transfer
|
||||
*
|
||||
* http://interface.eyecon.ro
|
||||
*
|
||||
* Copyright (c) 2006 Stefan Petre
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
*/
|
||||
eval(function(p,a,c,k,e,d){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--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[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}('1.2=q;1.Q.P=i(o){p m.O(\'s\',i(){R 1.A.w(m,o)})};1.A.w=i(e,o){5(1.2==q){1(\'S\',n).V(\'<t N="2"></t>\');1.2=1(\'#2\')}1.2.3(\'B\',\'T\').3(\'W\',\'L\');I z=m;z.c=1(e);5(!o||!o.4){p}5(o.4.H==K&&n.G(o.4)){o.4=n.G(o.4)}J 5(!o.4.M){p}5(!o.a){o.a=U}z.a=o.a;z.4=o.4;z.b=o.10;z.9=o.9;5(z.b){1.2.19(z.b)}z.g=0;z.h=0;5(1.18){z.g=(6(1.2.3(\'17\'))||0)+(6(1.2.3(\'1a\'))||0)+(6(1.2.3(\'X\'))||0)+(6(1.2.3(\'1d\'))||0);z.h=(6(1.2.3(\'1c\'))||0)+(6(1.2.3(\'16\'))||0)+(6(1.2.3(\'15\'))||0)+(6(1.2.3(\'Z\'))||0)}z.7=1.u(1.k.v(z.c.l(0)),1.k.r(z.c.l(0)));z.8=1.u(1.k.v(z.4),1.k.r(z.4));z.7.j-=z.g;z.7.d-=z.h;z.8.j-=z.g;z.8.d-=z.h;z.11=o.9;1.2.3(\'C\',z.7.j+\'f\').3(\'E\',z.7.d+\'f\').3(\'F\',z.7.y+\'f\').3(\'D\',z.7.x+\'f\').13({F:z.8.y,D:z.8.x,C:z.8.j,E:z.8.d},z.a,i(){5(z.b)1.2.1b(z.b);1.2.3(\'B\',\'1e\');5(z.9&&z.9.H==Y){z.9.14(z.c.l(0),[z.4])}1.12(z.c.l(0),\'s\')})};',62,77,'|jQuery|transferHelper|css|to|if|parseInt|start|end|complete|duration|classname|el|hb||px|diffWidth|diffHeight|function|wb|iUtil|get|this|document||return|null|getSize|interfaceFX|div|extend|getPosition|itransferTo||||fx|display|width|left|height|top|getElementById|constructor|var|else|String|absolute|childNodes|id|queue|TransferTo|fn|new|body|block|500|append|position|paddingLeft|Function|paddingBottom|className|callback|dequeue|animate|apply|paddingTop|borderBottomWidth|borderLeftWidth|boxModel|addClass|borderRightWidth|removeClass|borderTopWidth|paddingRight|none'.split('|'),0,{}))
|
||||
@@ -0,0 +1,3 @@
|
||||
/* jQMinMax v0.1 - Copyright (c) 2006 Dave Cardwell (http://davecardwell.co.uk/)
|
||||
Released under the MIT License (http://www.opensource.org/licenses/mit-license.php) */
|
||||
eval(function(p,a,c,k,e,d){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--){d[e(c)]=k[c]||e(c)}k=[(function(e){return d[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}('u m(){$.5={D:y,v:y};$(G).12(m(){8 h=G.W(\'I\');$(h).e({\'3\':\'J\',\'6-3\':\'K\'});$(\'L\').M(h);$.5.v=(h.s&&h.s==2);$(h).N();b($.5.v)o;$.5.D=O;$.5.A();$(\':5\').5()});$.5.A=m(){8 p=u E(\'6-3\',\'6-4\',\'9-3\',\'9-4\');8 5=u E();Q(8 i=0;i<p.R;i++){8 n="$.e(a,\'"+p[i]+"\')!=\'S\'&&"+"$.e(a,\'"+p[i]+"\')!=\'z\'&&"+"$.e(a,\'"+p[i]+"\')!=f.g";b(p[i].U(2)==\'x\')n+="&&$.e(a,\'"+p[i]+"\')!=\'X\'";$.n[\':\'][p[i]]=n;5[i]=\'(\'+n+\')\'}$.n[\':\'][\'5\']=5.Y(\'||\')};$.Z.5=m(){o $(c).10(m(){8 7={\'6-3\':r(c,\'6-3\'),\'9-3\':r(c,\'9-3\'),\'6-4\':r(c,\'6-4\'),\'9-4\':r(c,\'9-4\')};8 3=c.s;8 4=c.w;8 k=3;8 l=4;b(7[\'9-3\']!=f.g&&k>7[\'9-3\'])k=7[\'9-3\'];b(7[\'6-3\']!=f.g&&k<7[\'6-3\'])k=7[\'6-3\'];b(7[\'9-4\']!=f.g&&l>7[\'9-4\'])l=7[\'9-4\'];b(7[\'6-4\']!=f.g&&l<7[\'6-4\'])l=7[\'6-4\'];b(k!=3)$(c).e(\'3\',k);b(l!=4)$(c).e(\'4\',l)})};m r(t,p){8 q=$(t).e(p);b(q==f.g||q==\'z\')o f.g;8 j;j=q.B(/^\\+?(\\d*(?:\\.\\d+)?)%$/);b(j){o T.V(C((/3$/.h(p)?$(t).F().H(0).s:$(t).F().H(0).w)*j[1]/P))}j=q.B(/^\\+?(\\d*(?:\\.\\d+)?)(?:11)?$/);b(j){o C(j[1])}o f.g}}();',62,65,'|||width|height|minmax|min|constraint|var|max||if|this||css|window|undefined|test||result|newWidth|newHeight|function|expr|return||raw|calculate|offsetWidth|obj|new|native|offsetHeight||false|auto|expressions|match|Number|active|Array|parent|document|get|div|1px|2px|body|append|remove|true|100|for|length|0px|Math|charAt|round|createElement|none|join|fn|each|px|ready'.split('|'),0,{}))
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* --------------------------------------------------------------------
|
||||
* jQuery-Plugin "pngFix"
|
||||
* Version: 1.1, 11.09.2007
|
||||
* by Andreas Eberhard, andreas.eberhard@gmail.com
|
||||
* http://jquery.andreaseberhard.de/
|
||||
*
|
||||
* Copyright (c) 2007 Andreas Eberhard
|
||||
* Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
|
||||
*/
|
||||
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}('(s($){3.1s.1k=s(j){j=3.1a({12:\'1m.1j\'},j);8 k=(n.P=="r 10 Z"&&U(n.v)==4&&n.v.E("14 5.5")!=-1);8 l=(n.P=="r 10 Z"&&U(n.v)==4&&n.v.E("14 6.0")!=-1);o(3.17.16&&(k||l)){3(2).L("1r[@m$=.M]").z(s(){3(2).7(\'q\',3(2).q());3(2).7(\'p\',3(2).p());8 a=\'\';8 b=\'\';8 c=(3(2).7(\'K\'))?\'K="\'+3(2).7(\'K\')+\'" \':\'\';8 d=(3(2).7(\'A\'))?\'A="\'+3(2).7(\'A\')+\'" \':\'\';8 e=(3(2).7(\'C\'))?\'C="\'+3(2).7(\'C\')+\'" \':\'\';8 f=(3(2).7(\'B\'))?\'B="\'+3(2).7(\'B\')+\'" \':\'\';8 g=(3(2).7(\'R\'))?\'1d:\'+3(2).7(\'R\')+\';\':\'\';8 h=(3(2).1c().7(\'1b\'))?\'19:18;\':\'\';o(2.9.y){a+=\'y:\'+2.9.y+\';\';2.9.y=\'\'}o(2.9.t){a+=\'t:\'+2.9.t+\';\';2.9.t=\'\'}o(2.9.w){a+=\'w:\'+2.9.w+\';\';2.9.w=\'\'}8 i=(2.9.15);b+=\'<x \'+c+d+e+f;b+=\'9="13:11;1q-1p:1o-1n;O:W-V;N:1l;\'+g+h;b+=\'q:\'+3(2).q()+\'u;\'+\'p:\'+3(2).p()+\'u;\';b+=\'J:I:H.r.G\'+\'(m=\\\'\'+3(2).7(\'m\')+\'\\\', D=\\\'F\\\');\';b+=i+\'"></x>\';o(a!=\'\'){b=\'<x 9="13:11;O:W-V;\'+a+h+\'q:\'+3(2).q()+\'u;\'+\'p:\'+3(2).p()+\'u;\'+\'">\'+b+\'</x>\'}3(2).1i();3(2).1h(b)});3(2).L("*").z(s(){8 a=3(2).T(\'N-S\');o(a.E(".M")!=-1){8 b=a.X(\'1g("\')[1].X(\'")\')[0];3(2).T(\'N-S\',\'1f\');3(2).Q(0).Y.J="I:H.r.G(m=\'"+b+"\',D=\'F\')"}});3(2).L("1e[@m$=.M]").z(s(){8 a=3(2).7(\'m\');3(2).Q(0).Y.J=\'I:H.r.G\'+\'(m=\\\'\'+a+\'\\\', D=\\\'F\\\');\';3(2).7(\'m\',j.12)})}1t 3}})(3);',62,92,'||this|jQuery||||attr|var|style|||||||||||||src|navigator|if|height|width|Microsoft|function|padding|px|appVersion|margin|span|border|each|class|alt|title|sizingMethod|indexOf|scale|AlphaImageLoader|DXImageTransform|progid|filter|id|find|png|background|display|appName|get|align|image|css|parseInt|block|inline|split|runtimeStyle|Explorer|Internet|relative|blankgif|position|MSIE|cssText|msie|browser|hand|cursor|extend|href|parent|float|input|none|url|after|hide|gif|pngFix|transparent|blank|line|pre|space|white|img|fn|return'.split('|'),0,{}))
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* jQuery.ScrollTo - Easy element scrolling using jQuery.
|
||||
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
|
||||
* Dual licensed under MIT and GPL.
|
||||
* Date: 5/25/2009
|
||||
* @author Ariel Flesler
|
||||
* @version 1.4.2
|
||||
*
|
||||
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
|
||||
*/
|
||||
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* jQuery.SerialScroll - Animated scrolling of series
|
||||
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
|
||||
* Dual licensed under MIT and GPL.
|
||||
* Date: 06/14/2009
|
||||
* @author Ariel Flesler
|
||||
* @version 1.2.2
|
||||
* http://flesler.blogspot.com/2008/02/jqueryserialscroll.html
|
||||
*/
|
||||
;(function(a){var b=a.serialScroll=function(c){return a(window).serialScroll(c)};b.defaults={duration:1e3,axis:"x",event:"click",start:0,step:1,lock:!0,cycle:!0,constant:!0};a.fn.serialScroll=function(c){return this.each(function(){var t=a.extend({},b.defaults,c),s=t.event,i=t.step,r=t.lazy,e=t.target?this:document,u=a(t.target||this,e),p=u[0],m=t.items,h=t.start,g=t.interval,k=t.navigation,l;if(!r){m=d()}if(t.force){f({},h)}a(t.prev||[],e).bind(s,-i,q);a(t.next||[],e).bind(s,i,q);if(!p.ssbound){u.bind("prev.serialScroll",-i,q).bind("next.serialScroll",i,q).bind("goto.serialScroll",f)}if(g){u.bind("start.serialScroll",function(v){if(!g){o();g=!0;n()}}).bind("stop.serialScroll",function(){o();g=!1})}u.bind("notify.serialScroll",function(x,w){var v=j(w);if(v>-1){h=v}});p.ssbound=!0;if(t.jump){(r?u:d()).bind(s,function(v){f(v,j(v.target))})}if(k){k=a(k,e).bind(s,function(v){v.data=Math.round(d().length/k.length)*k.index(this);f(v,this)})}function q(v){v.data+=h;f(v,this)}function f(B,z){if(!isNaN(z)){B.data=z;z=p}var C=B.data,v,D=B.type,A=t.exclude?d().slice(0,-t.exclude):d(),y=A.length,w=A[C],x=t.duration;if(D){B.preventDefault()}if(g){o();l=setTimeout(n,t.interval)}if(!w){v=C<0?0:y-1;if(h!=v){C=v}else{if(!t.cycle){return}else{C=y-v-1}}w=A[C]}if(!w||t.lock&&u.is(":animated")||D&&t.onBefore&&t.onBefore(B,w,u,d(),C)===!1){return}if(t.stop){u.queue("fx",[]).stop()}if(t.constant){x=Math.abs(x/i*(h-C))}u.scrollTo(w,x,t).trigger("notify.serialScroll",[C])}function n(){u.trigger("next.serialScroll")}function o(){clearTimeout(l)}function d(){return a(m,p)}function j(w){if(!isNaN(w)){return w}var x=d(),v;while((v=x.index(w))==-1&&w!=p){w=w.parentNode}return v}})}})(jQuery);
|
||||
@@ -0,0 +1,308 @@
|
||||
/**
|
||||
* TableDnD plug-in for JQuery, allows you to drag and drop table rows
|
||||
* Copyright (c) Denis Howlett <denish@isocra.com>
|
||||
* Licensed like jQuery, see http://docs.jquery.com/License.
|
||||
*/
|
||||
jQuery.tableDnD = {
|
||||
/** Keep hold of the current table being dragged */
|
||||
currentTable : null,
|
||||
/** Keep hold of the current drag object if any */
|
||||
dragObject: null,
|
||||
/** The current mouse offset */
|
||||
mouseOffset: null,
|
||||
/** Remember the old value of Y so that we don't do too much processing */
|
||||
oldY: 0,
|
||||
|
||||
/** Actually build the structure */
|
||||
build: function(options) {
|
||||
// Set up the defaults if any
|
||||
|
||||
this.each(function() {
|
||||
// This is bound to each matching table, set up the defaults and override with user options
|
||||
this.tableDnDConfig = jQuery.extend({
|
||||
onDragStyle: null,
|
||||
onDropStyle: null,
|
||||
// Add in the default class for whileDragging
|
||||
onDragClass: "tDnD_whileDrag",
|
||||
onDrop: null,
|
||||
onDragStart: null,
|
||||
scrollAmount: 5,
|
||||
serializeRegexp: /[^\-]*$/, // The regular expression to use to trim row IDs
|
||||
serializeParamName: null, // If you want to specify another parameter name instead of the table ID
|
||||
dragHandle: null // If you give the name of a class here, then only Cells with this class will be draggable
|
||||
}, options || {});
|
||||
// Now make the rows draggable
|
||||
jQuery.tableDnD.makeDraggable(this);
|
||||
});
|
||||
|
||||
// Now we need to capture the mouse up and mouse move event
|
||||
// We can use bind so that we don't interfere with other event handlers
|
||||
jQuery(document)
|
||||
.bind('mousemove', jQuery.tableDnD.mousemove)
|
||||
.bind('mouseup', jQuery.tableDnD.mouseup);
|
||||
|
||||
// Don't break the chain
|
||||
return this;
|
||||
},
|
||||
|
||||
/** This function makes all the rows on the table draggable apart from those marked as "NoDrag" */
|
||||
makeDraggable: function(table) {
|
||||
var config = table.tableDnDConfig;
|
||||
if (table.tableDnDConfig.dragHandle) {
|
||||
// We only need to add the event to the specified cells
|
||||
var cells = jQuery("td."+table.tableDnDConfig.dragHandle, table);
|
||||
cells.each(function() {
|
||||
// The cell is bound to "this"
|
||||
jQuery(this).mousedown(function(ev) {
|
||||
jQuery.tableDnD.dragObject = this.parentNode;
|
||||
jQuery.tableDnD.currentTable = table;
|
||||
jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev);
|
||||
if (config.onDragStart) {
|
||||
// Call the onDrop method if there is one
|
||||
config.onDragStart(table, this);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
})
|
||||
} else {
|
||||
// For backwards compatibility, we add the event to the whole row
|
||||
var rows = jQuery("tbody tr", table); // get all the rows as a wrapped set
|
||||
rows.each(function() {
|
||||
// Iterate through each row, the row is bound to "this"
|
||||
var row = jQuery(this);
|
||||
if (! row.hasClass("nodrag")) {
|
||||
row.mousedown(function(ev) {
|
||||
if (ev.target.tagName == "TD") {
|
||||
jQuery.tableDnD.dragObject = this;
|
||||
jQuery.tableDnD.currentTable = table;
|
||||
jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev);
|
||||
if (config.onDragStart) {
|
||||
// Call the onDrop method if there is one
|
||||
config.onDragStart(table, this);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}).css("cursor", "move"); // Store the tableDnD object
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
updateTables: function() {
|
||||
this.each(function() {
|
||||
// this is now bound to each matching table
|
||||
if (this.tableDnDConfig) {
|
||||
jQuery.tableDnD.makeDraggable(this);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/** Get the mouse coordinates from the event (allowing for browser differences) */
|
||||
mouseCoords: function(ev){
|
||||
if(ev.pageX || ev.pageY){
|
||||
return {x:ev.pageX, y:ev.pageY};
|
||||
}
|
||||
return {
|
||||
x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
|
||||
y:ev.clientY + document.body.scrollTop - document.body.clientTop
|
||||
};
|
||||
},
|
||||
|
||||
/** Given a target element and a mouse event, get the mouse offset from that element.
|
||||
To do this we need the element's position and the mouse position */
|
||||
getMouseOffset: function(target, ev) {
|
||||
ev = ev || window.event;
|
||||
|
||||
var docPos = this.getPosition(target);
|
||||
var mousePos = this.mouseCoords(ev);
|
||||
return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
|
||||
},
|
||||
|
||||
/** Get the position of an element by going up the DOM tree and adding up all the offsets */
|
||||
getPosition: function(e){
|
||||
var left = 0;
|
||||
var top = 0;
|
||||
/** Safari fix -- thanks to Luis Chato for this! */
|
||||
if (e.offsetHeight == 0) {
|
||||
/** Safari 2 doesn't correctly grab the offsetTop of a table row
|
||||
this is detailed here:
|
||||
http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in-safari/
|
||||
the solution is likewise noted there, grab the offset of a table cell in the row - the firstChild.
|
||||
note that firefox will return a text node as a first child, so designing a more thorough
|
||||
solution may need to take that into account, for now this seems to work in firefox, safari, ie */
|
||||
e = e.firstChild; // a table cell
|
||||
}
|
||||
|
||||
while (e.offsetParent){
|
||||
left += e.offsetLeft;
|
||||
top += e.offsetTop;
|
||||
e = e.offsetParent;
|
||||
}
|
||||
|
||||
left += e.offsetLeft;
|
||||
top += e.offsetTop;
|
||||
|
||||
return {x:left, y:top};
|
||||
},
|
||||
|
||||
mousemove: function(ev) {
|
||||
if (jQuery.tableDnD.dragObject == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var dragObj = jQuery(jQuery.tableDnD.dragObject);
|
||||
var config = jQuery.tableDnD.currentTable.tableDnDConfig;
|
||||
var mousePos = jQuery.tableDnD.mouseCoords(ev);
|
||||
var y = mousePos.y - jQuery.tableDnD.mouseOffset.y;
|
||||
//auto scroll the window
|
||||
var yOffset = window.pageYOffset;
|
||||
if (document.all) {
|
||||
// Windows version
|
||||
//yOffset=document.body.scrollTop;
|
||||
if (typeof document.compatMode != 'undefined' &&
|
||||
document.compatMode != 'BackCompat') {
|
||||
yOffset = document.documentElement.scrollTop;
|
||||
}
|
||||
else if (typeof document.body != 'undefined') {
|
||||
yOffset=document.body.scrollTop;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (mousePos.y-yOffset < config.scrollAmount) {
|
||||
window.scrollBy(0, -config.scrollAmount);
|
||||
} else {
|
||||
var windowHeight = window.innerHeight ? window.innerHeight
|
||||
: document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
|
||||
if (windowHeight-(mousePos.y-yOffset) < config.scrollAmount) {
|
||||
window.scrollBy(0, config.scrollAmount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (y != jQuery.tableDnD.oldY) {
|
||||
// work out if we're going up or down...
|
||||
var movingDown = y > jQuery.tableDnD.oldY;
|
||||
// update the old value
|
||||
jQuery.tableDnD.oldY = y;
|
||||
// update the style to show we're dragging
|
||||
if (config.onDragClass) {
|
||||
dragObj.addClass(config.onDragClass);
|
||||
} else {
|
||||
dragObj.css(config.onDragStyle);
|
||||
}
|
||||
// If we're over a row then move the dragged row to there so that the user sees the
|
||||
// effect dynamically
|
||||
var currentRow = jQuery.tableDnD.findDropTargetRow(dragObj, y);
|
||||
if (currentRow) {
|
||||
// TODO worry about what happens when there are multiple TBODIES
|
||||
if (movingDown && jQuery.tableDnD.dragObject != currentRow) {
|
||||
jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow.nextSibling);
|
||||
} else if (! movingDown && jQuery.tableDnD.dragObject != currentRow) {
|
||||
jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/** We're only worried about the y position really, because we can only move rows up and down */
|
||||
findDropTargetRow: function(draggedRow, y) {
|
||||
var rows = jQuery.tableDnD.currentTable.rows;
|
||||
for (var i=0; i<rows.length; i++) {
|
||||
var row = rows[i];
|
||||
var rowY = this.getPosition(row).y;
|
||||
var rowHeight = parseInt(row.offsetHeight)/2;
|
||||
if (row.offsetHeight == 0) {
|
||||
rowY = this.getPosition(row.firstChild).y;
|
||||
rowHeight = parseInt(row.firstChild.offsetHeight)/2;
|
||||
}
|
||||
// Because we always have to insert before, we need to offset the height a bit
|
||||
if ((y > rowY - rowHeight) && (y < (rowY + rowHeight))) {
|
||||
// that's the row we're over
|
||||
// If it's the same as the current row, ignore it
|
||||
if (row == draggedRow) {return null;}
|
||||
var config = jQuery.tableDnD.currentTable.tableDnDConfig;
|
||||
if (config.onAllowDrop) {
|
||||
if (config.onAllowDrop(draggedRow, row)) {
|
||||
return row;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
// If a row has nodrop class, then don't allow dropping (inspired by John Tarr and Famic)
|
||||
var nodrop = jQuery(row).hasClass("nodrop");
|
||||
if (! nodrop) {
|
||||
return row;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return row;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
mouseup: function(e) {
|
||||
if (jQuery.tableDnD.currentTable && jQuery.tableDnD.dragObject) {
|
||||
var droppedRow = jQuery.tableDnD.dragObject;
|
||||
var config = jQuery.tableDnD.currentTable.tableDnDConfig;
|
||||
// If we have a dragObject, then we need to release it,
|
||||
// The row will already have been moved to the right place so we just reset stuff
|
||||
if (config.onDragClass) {
|
||||
jQuery(droppedRow).removeClass(config.onDragClass);
|
||||
} else {
|
||||
jQuery(droppedRow).css(config.onDropStyle);
|
||||
}
|
||||
jQuery.tableDnD.dragObject = null;
|
||||
if (config.onDrop) {
|
||||
// Call the onDrop method if there is one
|
||||
config.onDrop(jQuery.tableDnD.currentTable, droppedRow);
|
||||
}
|
||||
jQuery.tableDnD.currentTable = null; // let go of the table too
|
||||
}
|
||||
},
|
||||
|
||||
serialize: function() {
|
||||
if (jQuery.tableDnD.currentTable) {
|
||||
return jQuery.tableDnD.serializeTable(jQuery.tableDnD.currentTable);
|
||||
} else {
|
||||
return "Error: No Table id set, you need to set an id on your table and every row";
|
||||
}
|
||||
},
|
||||
|
||||
serializeTable: function(table) {
|
||||
var result = "";
|
||||
var tableId = table.id;
|
||||
var rows = jQuery("tbody tr", table);
|
||||
for (var i=0; i<rows.length; i++) {
|
||||
if (result.length > 0) result += "&";
|
||||
var rowId = rows[i].id;
|
||||
if (rowId && rowId && table.tableDnDConfig && table.tableDnDConfig.serializeRegexp) {
|
||||
rowId = rowId.match(table.tableDnDConfig.serializeRegexp)[0];
|
||||
}
|
||||
|
||||
result += tableId + '[]=' + rowId;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
serializeTables: function() {
|
||||
var result = "";
|
||||
this.each(function() {
|
||||
// this is now bound to each matching table
|
||||
result += jQuery.tableDnD.serializeTable(this);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
jQuery.fn.extend(
|
||||
{
|
||||
tableDnD : jQuery.tableDnD.build,
|
||||
tableDnDUpdate : jQuery.tableDnD.updateTables,
|
||||
tableDnDSerialize: jQuery.tableDnD.serializeTables
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* TypeWatch 2.0 - Original by Denny Ferrassoli / Refactored by Charles Christolini
|
||||
*
|
||||
* Examples/Docs: www.dennydotnet.com
|
||||
*
|
||||
* Copyright(c) 2007 Denny Ferrassoli - DennyDotNet.com
|
||||
* Coprright(c) 2008 Charles Christolini - BinaryPie.com
|
||||
* Modified by Lucas CHERIFI @ PrestaShop : now this plugin works with the Dean Edward's JS Packer
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
(function(jQuery) {
|
||||
jQuery.fn.typeWatch = function(o){
|
||||
// Options
|
||||
var options = jQuery.extend({
|
||||
wait : 750,
|
||||
callback : function() { },
|
||||
highlight : true,
|
||||
captureLength : 2
|
||||
}, o);
|
||||
|
||||
function checkElement(timer, override) {
|
||||
var elTxt = jQuery(timer.el).val();
|
||||
|
||||
// Fire if text > options.captureLength AND text != saved txt OR if override AND text > options.captureLength
|
||||
if ((elTxt.length > options.captureLength && elTxt.toUpperCase() != timer.text)
|
||||
|| (override && elTxt.length > options.captureLength)) {
|
||||
timer.text = elTxt.toUpperCase();
|
||||
timer.cb(elTxt);
|
||||
}
|
||||
};
|
||||
|
||||
function watchElement(elem) {
|
||||
// Must be text or textarea
|
||||
if (elem.type.toUpperCase() == "TEXT" || elem.nodeName.toUpperCase() == "TEXTAREA") {
|
||||
|
||||
// Allocate timer element
|
||||
var timer = {
|
||||
timer : null,
|
||||
text : jQuery(elem).val().toUpperCase(),
|
||||
cb : options.callback,
|
||||
el : elem,
|
||||
wait : options.wait
|
||||
};
|
||||
|
||||
// Set focus action (highlight)
|
||||
if (options.highlight) {
|
||||
jQuery(elem).focus(
|
||||
function() {
|
||||
this.select();
|
||||
});
|
||||
}
|
||||
|
||||
// Key watcher / clear and reset the timer
|
||||
var startWatch = function(evt) {
|
||||
var timerWait = timer.wait;
|
||||
var overrideBool = false;
|
||||
|
||||
if (evt.keyCode == 13 && this.type.toUpperCase() == "TEXT") {
|
||||
timerWait = 1;
|
||||
overrideBool = true;
|
||||
}
|
||||
|
||||
var timerCallbackFx = function()
|
||||
{
|
||||
checkElement(timer, overrideBool);
|
||||
}
|
||||
|
||||
// Clear timer
|
||||
clearTimeout(timer.timer);
|
||||
timer.timer = setTimeout(timerCallbackFx, timerWait);
|
||||
|
||||
};
|
||||
|
||||
jQuery(elem).keydown(startWatch);
|
||||
}
|
||||
};
|
||||
|
||||
// Watch Each Element
|
||||
return this.each(function(index){
|
||||
watchElement(this);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,21 @@
|
||||
div.zoomdiv {
|
||||
z-index : 100;
|
||||
position : absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
width : 200px;
|
||||
height : 200px;
|
||||
background: #ffffff;
|
||||
border:1px solid #CCCCCC;
|
||||
display:none;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
|
||||
|
||||
img.jqzoom{
|
||||
cursor:crosshair;
|
||||
position:relative;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
//**************************************************************
|
||||
// jQZoom allows you to realize a small magnifier window,close
|
||||
// to the image or images on your web page easily.
|
||||
//
|
||||
// jqZoom version 1.2
|
||||
// Author Doc. Ing. Renzi Marco(www.mind-projects.it)
|
||||
// Released on Dec 05 2007
|
||||
// i'm searching for a job,pick me up!!!
|
||||
// mail: renzi.mrc@gmail.com
|
||||
//**************************************************************
|
||||
|
||||
(function($) {
|
||||
$.fn.jqueryzoom = function(options) {
|
||||
var settings = {
|
||||
xzoom: 200, //zoomed width default width
|
||||
yzoom: 200, //zoomed div default width
|
||||
offset: 10, //zoomed div default offset
|
||||
position: "right" //zoomed div default position,offset position is to the right of the image
|
||||
};
|
||||
|
||||
if(options)
|
||||
$.extend(settings, options);
|
||||
|
||||
var noalt ='';
|
||||
|
||||
$(this).hover(function() {
|
||||
var imageLeft = $(this).get(0).offsetLeft;
|
||||
var imageTop = $(this).get(0).offsetTop;
|
||||
var imageWidth = $(this).get(0).offsetWidth;
|
||||
var imageHeight = $(this).get(0).offsetHeight;
|
||||
|
||||
noalt = $(this).attr("alt");
|
||||
var bigimage = noalt;
|
||||
$(this).attr("alt", '');
|
||||
|
||||
if($("div.zoomdiv").get().length == 0)
|
||||
$(this).after("<div class='zoomdiv'><img class='bigimg' src='"+bigimage+"'/></div>");
|
||||
|
||||
if(settings.position == "right")
|
||||
leftpos = imageLeft + imageWidth + settings.offset;
|
||||
else
|
||||
leftpos = imageLeft - settings.xzoom - settings.offset;
|
||||
|
||||
$("div.zoomdiv").css({top: imageTop,left: leftpos});
|
||||
$("div.zoomdiv").width(settings.xzoom);
|
||||
$("div.zoomdiv").height(settings.yzoom);
|
||||
$("div.zoomdiv").show();
|
||||
|
||||
$(document.body).mousemove(function(e) {
|
||||
var bigwidth = $(".bigimg").get(0).offsetWidth;
|
||||
var bigheight = $(".bigimg").get(0).offsetHeight;
|
||||
var scaley ='x';
|
||||
var scalex= 'y';
|
||||
|
||||
if(isNaN(scalex)|isNaN(scaley)) {
|
||||
var scalex = Math.round(bigwidth/imageWidth) ;
|
||||
var scaley = Math.round(bigheight/imageHeight);
|
||||
}
|
||||
|
||||
mouse = new MouseEvent(e);
|
||||
|
||||
scrolly = mouse.y - imageTop - ($("div.zoomdiv").height()*1/scaley)/2 ;
|
||||
$("div.zoomdiv").get(0).scrollTop = scrolly * scaley ;
|
||||
scrollx = mouse.x - imageLeft - ($("div.zoomdiv").width()*1/scalex)/2 ;
|
||||
$("div.zoomdiv").get(0).scrollLeft = (scrollx) * scalex ;
|
||||
});
|
||||
}, function() {
|
||||
$(this).attr("alt", noalt);
|
||||
$("div.zoomdiv").hide();
|
||||
$(document.body).unbind("mousemove");
|
||||
$(".lenszoom").remove();
|
||||
$("div.zoomdiv").remove();
|
||||
});
|
||||
}
|
||||
})(jQuery);
|
||||
|
||||
function MouseEvent(e) {
|
||||
this.x = e.pageX
|
||||
this.y = e.pageY
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
.tab-pane {
|
||||
float: left;
|
||||
position: relative;
|
||||
width: 928px;
|
||||
}
|
||||
|
||||
.tab-pane-tax {
|
||||
float: left;
|
||||
position: relative;
|
||||
width: 900px;
|
||||
}
|
||||
|
||||
.tab-row .tab {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
display: inline;
|
||||
margin: 0;
|
||||
float: left;
|
||||
padding: 2px 8px 3px 8px;
|
||||
background: #EFEFEF;
|
||||
z-index: 1;
|
||||
white-space: nowrap;
|
||||
position: relative;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
.tab-row .tab.selected {
|
||||
border: 1px solid #ccc;
|
||||
border-bottom: 0;
|
||||
background: #FFF6D3;
|
||||
z-index: 3;
|
||||
padding: 2px 25px 4px 25px;
|
||||
margin: 1px -3px -3px 0px;
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
.tab-page {
|
||||
clear: both;
|
||||
border: 1px solid #ccc;
|
||||
background: #FFFFF0;
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.tab-page table tr td.col-left {
|
||||
width: 150px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.tab-page table tr td p {
|
||||
margin: 0.5em 0 0 0;
|
||||
padding: 0 0 0.5em 0;
|
||||
color: #7F7F7F;
|
||||
font-size: 0.95em;
|
||||
}
|
||||
|
||||
.tab-page table tr td p.block {
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.tab-row {
|
||||
z-index: 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,287 @@
|
||||
/*----------------------------------------------------------------------------\
|
||||
| Tab Pane 1.02 |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Created by Erik Arvidsson |
|
||||
| (http://webfx.eae.net/contact.html#erik) |
|
||||
| For WebFX (http://webfx.eae.net/) |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Copyright (c) 2002, 2003, 2006 Erik Arvidsson |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Licensed under the Apache License, Version 2.0 (the "License"); you may not |
|
||||
| use this file except in compliance with the License. You may obtain a copy |
|
||||
| of the License at http://www.apache.org/licenses/LICENSE-2.0 |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| Unless required by applicable law or agreed to in writing, software |
|
||||
| distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
|
||||
| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
|
||||
| License for the specific language governing permissions and limitations |
|
||||
| under the License. |
|
||||
\----------------------------------------------------------------------------*/
|
||||
|
||||
function hasSupport() {
|
||||
|
||||
if (typeof hasSupport.support != "undefined")
|
||||
return hasSupport.support;
|
||||
|
||||
var ie55 = /msie 5\.[56789]/i.test( navigator.userAgent );
|
||||
|
||||
hasSupport.support = ( typeof document.implementation != "undefined" &&
|
||||
document.implementation.hasFeature( "html", "1.0" ) || ie55 )
|
||||
|
||||
// IE55 has a serious DOM1 bug... Patch it!
|
||||
if ( ie55 ) {
|
||||
document._getElementsByTagName = document.getElementsByTagName;
|
||||
document.getElementsByTagName = function ( sTagName ) {
|
||||
if ( sTagName == "*" )
|
||||
return document.all;
|
||||
else
|
||||
return document._getElementsByTagName( sTagName );
|
||||
};
|
||||
}
|
||||
|
||||
return hasSupport.support;
|
||||
}
|
||||
|
||||
function WebFXTabPane( el ) {
|
||||
if ( !hasSupport() || el == null ) return;
|
||||
|
||||
this.element = el;
|
||||
this.element.tabPane = this;
|
||||
this.pages = [];
|
||||
this.selectedIndex = null;
|
||||
|
||||
// add class name tag to class name
|
||||
this.element.className = this.classNameTag + " " + this.element.className;
|
||||
|
||||
// add tab row
|
||||
this.tabRow = document.createElement( "div" );
|
||||
this.tabRow.className = "tab-row";
|
||||
el.insertBefore( this.tabRow, el.firstChild );
|
||||
|
||||
var tabIndex = pos_select;
|
||||
this.selectedIndex = tabIndex;
|
||||
|
||||
// loop through child nodes and add them
|
||||
var cs = el.childNodes;
|
||||
var n;
|
||||
for (var i = 0; i < cs.length; i++) {
|
||||
if (cs[i].nodeType == 1 && cs[i].className == "tab-page") {
|
||||
this.addTabPage( cs[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WebFXTabPane.prototype.classNameTag = "dynamic-tab-pane-control";
|
||||
|
||||
WebFXTabPane.prototype.setSelectedIndex = function ( n ) {
|
||||
if (this.selectedIndex != n) {
|
||||
if (this.selectedIndex != null && this.pages[ this.selectedIndex ] != null )
|
||||
this.pages[ this.selectedIndex ].hide();
|
||||
this.selectedIndex = n;
|
||||
this.pages[ this.selectedIndex ].show();
|
||||
|
||||
// Add-on jQuery
|
||||
loadTab(this.selectedIndex+1);
|
||||
}
|
||||
};
|
||||
|
||||
WebFXTabPane.prototype.getSelectedIndex = function () {
|
||||
return this.selectedIndex;
|
||||
};
|
||||
|
||||
WebFXTabPane.prototype.addTabPage = function ( oElement ) {
|
||||
if ( !hasSupport() ) return;
|
||||
|
||||
if ( oElement.tabPage == this ) // already added
|
||||
return oElement.tabPage;
|
||||
|
||||
var n = this.pages.length;
|
||||
var tp = this.pages[n] = new WebFXTabPage( oElement, this, n );
|
||||
tp.tabPane = this;
|
||||
|
||||
// move the tab out of the box
|
||||
this.tabRow.appendChild( tp.tab );
|
||||
|
||||
if ( n == this.selectedIndex )
|
||||
tp.show();
|
||||
else
|
||||
tp.hide();
|
||||
|
||||
return tp;
|
||||
};
|
||||
|
||||
WebFXTabPane.prototype.dispose = function () {
|
||||
this.element.tabPane = null;
|
||||
this.element = null;
|
||||
this.tabRow = null;
|
||||
|
||||
for (var i = 0; i < this.pages.length; i++) {
|
||||
this.pages[i].dispose();
|
||||
this.pages[i] = null;
|
||||
}
|
||||
this.pages = null;
|
||||
};
|
||||
|
||||
function WebFXTabPage( el, tabPane, nIndex ) {
|
||||
if ( !hasSupport() || el == null ) return;
|
||||
|
||||
this.element = el;
|
||||
this.element.tabPage = this;
|
||||
this.index = nIndex;
|
||||
|
||||
var cs = el.childNodes;
|
||||
for (var i = 0; i < cs.length; i++) {
|
||||
if (cs[i].nodeType == 1 && cs[i].className == "tab") {
|
||||
this.tab = cs[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var a = document.createElement( "A" );
|
||||
this.aElement = a;
|
||||
a.href = "#";
|
||||
a.onclick = function () { return false; };
|
||||
while ( this.tab.hasChildNodes() )
|
||||
a.appendChild( this.tab.firstChild );
|
||||
this.tab.appendChild( a );
|
||||
|
||||
var oThis = this;
|
||||
this.tab.onclick = function () { oThis.select(); };
|
||||
this.tab.onmouseover = function () { WebFXTabPage.tabOver( oThis ); };
|
||||
this.tab.onmouseout = function () { WebFXTabPage.tabOut( oThis ); };
|
||||
}
|
||||
|
||||
WebFXTabPage.prototype.show = function () {
|
||||
var el = this.tab;
|
||||
var s = el.className + " selected";
|
||||
s = s.replace(/ +/g, " ");
|
||||
el.className = s;
|
||||
|
||||
this.element.style.display = "block";
|
||||
pos_select = this.element.id.substring(4, 5) - 1;
|
||||
document.getElementById('tabs').value = pos_select;
|
||||
loadTab(pos_select+1);
|
||||
};
|
||||
|
||||
WebFXTabPage.prototype.hide = function () {
|
||||
var el = this.tab;
|
||||
var s = el.className;
|
||||
s = s.replace(/ selected/g, "");
|
||||
el.className = s;
|
||||
|
||||
this.element.style.display = "none";
|
||||
};
|
||||
|
||||
WebFXTabPage.prototype.select = function () {
|
||||
this.tabPane.setSelectedIndex( this.index );
|
||||
};
|
||||
|
||||
WebFXTabPage.prototype.dispose = function () {
|
||||
this.aElement.onclick = null;
|
||||
this.aElement = null;
|
||||
this.element.tabPage = null;
|
||||
this.tab.onclick = null;
|
||||
this.tab.onmouseover = null;
|
||||
this.tab.onmouseout = null;
|
||||
this.tab = null;
|
||||
this.tabPane = null;
|
||||
this.element = null;
|
||||
};
|
||||
|
||||
WebFXTabPage.tabOver = function ( tabpage ) {
|
||||
var el = tabpage.tab;
|
||||
var s = el.className + " hover";
|
||||
s = s.replace(/ +/g, " ");
|
||||
el.className = s;
|
||||
};
|
||||
|
||||
WebFXTabPage.tabOut = function ( tabpage ) {
|
||||
var el = tabpage.tab;
|
||||
var s = el.className;
|
||||
s = s.replace(/ hover/g, "");
|
||||
el.className = s;
|
||||
};
|
||||
|
||||
|
||||
// This function initializes all uninitialized tab panes and tab pages
|
||||
function setupAllTabs() {
|
||||
if ( !hasSupport() ) return;
|
||||
|
||||
var all = document.getElementsByTagName( "*" );
|
||||
var l = all.length;
|
||||
var tabPaneRe = /tab\-pane/;
|
||||
var tabPageRe = /tab\-page/;
|
||||
var cn, el;
|
||||
var parentTabPane;
|
||||
|
||||
for ( var i = 0; i < l; i++ ) {
|
||||
el = all[i]
|
||||
cn = el.className;
|
||||
|
||||
// no className
|
||||
if ( cn == "" ) continue;
|
||||
|
||||
// uninitiated tab pane
|
||||
if ( tabPaneRe.test( cn ) && !el.tabPane )
|
||||
new WebFXTabPane( el );
|
||||
|
||||
// unitiated tab page wit a valid tab pane parent
|
||||
else if ( tabPageRe.test( cn ) && !el.tabPage &&
|
||||
tabPaneRe.test( el.parentNode.className ) ) {
|
||||
el.parentNode.tabPane.addTabPage( el );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function disposeAllTabs() {
|
||||
if ( !hasSupport() ) return;
|
||||
|
||||
var all = document.getElementsByTagName( "*" );
|
||||
var l = all.length;
|
||||
var tabPaneRe = /tab\-pane/;
|
||||
var cn, el;
|
||||
var tabPanes = [];
|
||||
|
||||
for ( var i = 0; i < l; i++ ) {
|
||||
el = all[i]
|
||||
cn = el.className;
|
||||
|
||||
// no className
|
||||
if ( cn == "" ) continue;
|
||||
|
||||
// tab pane
|
||||
if ( tabPaneRe.test( cn ) && el.tabPane )
|
||||
tabPanes[tabPanes.length] = el.tabPane;
|
||||
}
|
||||
|
||||
for (var i = tabPanes.length - 1; i >= 0; i--) {
|
||||
tabPanes[i].dispose();
|
||||
tabPanes[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Select the right tabs
|
||||
if (!pos_select)
|
||||
pos_select = 0;
|
||||
|
||||
// DOM2
|
||||
if ( typeof window.addEventListener != "undefined" )
|
||||
window.addEventListener( "load", setupAllTabs, false );
|
||||
|
||||
// IE
|
||||
else if ( typeof window.attachEvent != "undefined" ) {
|
||||
window.attachEvent( "onload", setupAllTabs );
|
||||
window.attachEvent( "onunload", disposeAllTabs );
|
||||
}
|
||||
|
||||
else {
|
||||
if ( window.onload != null ) {
|
||||
var oldOnload = window.onload;
|
||||
window.onload = function ( e ) {
|
||||
oldOnload( e );
|
||||
setupAllTabs();
|
||||
};
|
||||
}
|
||||
else
|
||||
window.onload = setupAllTabs;
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
/* ----------------------------------------------------------------------------------------------------------------*/
|
||||
/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/
|
||||
/* ----------------------------------------------------------------------------------------------------------------*/
|
||||
*{padding: 0; margin: 0;}
|
||||
|
||||
/* ----------------------------------------------------------------------------------------------------------------*/
|
||||
/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
|
||||
/* ----------------------------------------------------------------------------------------------------------------*/
|
||||
#TB_window {
|
||||
font: 12px Arial, Helvetica, sans-serif;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
#TB_secondLine {
|
||||
font: 10px Arial, Helvetica, sans-serif;
|
||||
color:#666666;
|
||||
}
|
||||
|
||||
/*#TB_window a:link {color: #666666;}
|
||||
#TB_window a:visited {color: #666666;}
|
||||
#TB_window a:hover {color: #000;}
|
||||
#TB_window a:active {color: #666666;}
|
||||
#TB_window a:focus{color: #666666;}*/
|
||||
#TB_window h2 {
|
||||
text-align:center;
|
||||
padding-bottom: 25px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------------------------------------------*/
|
||||
/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/
|
||||
/* ----------------------------------------------------------------------------------------------------------------*/
|
||||
#TB_overlay {
|
||||
position: fixed;
|
||||
z-index:100;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
height:100%;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.TB_overlayMacFFBGHack {background: url(../img/macFFBgHack.png) repeat;}
|
||||
.TB_overlayBG {
|
||||
background-color:#000;
|
||||
filter:alpha(opacity=75);
|
||||
-moz-opacity: 0.75;
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
* html #TB_overlay { /* ie6 hack */
|
||||
position: absolute;
|
||||
height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
|
||||
}
|
||||
|
||||
#TB_window {
|
||||
position: fixed;
|
||||
background: #ffffff;
|
||||
z-index: 102;
|
||||
color:#000000;
|
||||
display:none;
|
||||
border: 4px solid #525252;
|
||||
text-align:left;
|
||||
top:50%;
|
||||
left:50%;
|
||||
}
|
||||
|
||||
* html #TB_window { /* ie6 hack */
|
||||
position: absolute;
|
||||
margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
|
||||
}
|
||||
|
||||
#TB_window img#TB_Image {
|
||||
display:block;
|
||||
margin: 15px 0 0 15px;
|
||||
border-right: 1px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
border-top: 1px solid #666;
|
||||
border-left: 1px solid #666;
|
||||
}
|
||||
|
||||
#TB_caption{
|
||||
height:25px;
|
||||
padding:7px 30px 10px 25px;
|
||||
float:left;
|
||||
}
|
||||
|
||||
#TB_closeWindow{
|
||||
height:25px;
|
||||
padding:11px 25px 10px 0;
|
||||
float:right;
|
||||
}
|
||||
|
||||
#TB_closeAjaxWindow{
|
||||
padding:7px 10px 5px 0;
|
||||
margin-bottom:1px;
|
||||
text-align:right;
|
||||
float:right;
|
||||
}
|
||||
|
||||
#TB_ajaxWindowTitle{
|
||||
float:left;
|
||||
padding:7px 0 5px 10px;
|
||||
margin-bottom:1px;
|
||||
}
|
||||
|
||||
#TB_title{
|
||||
background-color:#e8e8e8;
|
||||
height:27px;
|
||||
}
|
||||
|
||||
#TB_ajaxContent{
|
||||
clear:both;
|
||||
padding:2px 15px 15px 15px;
|
||||
overflow:auto;
|
||||
text-align:left;
|
||||
line-height:1.4em;
|
||||
}
|
||||
|
||||
#TB_ajaxContent.TB_modal{
|
||||
padding:15px;
|
||||
}
|
||||
|
||||
#TB_ajaxContent p{
|
||||
padding:5px 0px 5px 0px;
|
||||
}
|
||||
|
||||
#TB_load{
|
||||
position: fixed;
|
||||
display:none;
|
||||
height:13px;
|
||||
width:208px;
|
||||
z-index:103;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
|
||||
}
|
||||
|
||||
* html #TB_load { /* ie6 hack */
|
||||
position: absolute;
|
||||
margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
|
||||
}
|
||||
|
||||
#TB_HideSelect{
|
||||
z-index:99;
|
||||
position:fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background-color:#fff;
|
||||
border:none;
|
||||
filter:alpha(opacity=0);
|
||||
-moz-opacity: 0;
|
||||
opacity: 0;
|
||||
height:100%;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
* html #TB_HideSelect { /* ie6 hack */
|
||||
position: absolute;
|
||||
height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
|
||||
}
|
||||
|
||||
#TB_iframeContent{
|
||||
clear:both;
|
||||
border:none;
|
||||
margin-bottom:-1px;
|
||||
margin-top:1px;
|
||||
_margin-bottom:1px;
|
||||
}
|
||||
|
||||
*+html #TB_window { /* ie7 hack */
|
||||
position: absolute;
|
||||
margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Thickbox 3.1 - One Box To Rule Them All.
|
||||
* By Cody Lindley (http://www.codylindley.com)
|
||||
* Copyright (c) 2007 cody lindley
|
||||
* Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* Patched Version by Jamie Thompson - Fixes IE7 Positioning Issues
|
||||
* http://jamazon.co.uk/web/2008/03/17/thickbox-31-ie7-positioning-bug/
|
||||
* Patched Version by PrestaShop - Translated fields
|
||||
* http://www.prestashop.com
|
||||
*/
|
||||
|
||||
|
||||
$.browser.msie6=$.browser.msie&&/MSIE 6\.0/i.test(window.navigator.userAgent)&&!/MSIE 7\.0/i.test(window.navigator.userAgent);$(document).ready(function(){tb_init('a.thickbox, area.thickbox, input.thickbox');imgLoader=new Image();imgLoader.src=tb_pathToImage;});function tb_init(domChunk){$(domChunk).click(function(){var t=this.title||this.name||null;var a=this.href||this.alt;var g=this.rel||false;tb_show(t,a,g);this.blur();return false;}).removeClass('thickbox');}
|
||||
function tb_show(caption,url,imageGroup){try{if(typeof document.body.style.maxHeight==="undefined"){$("body","html").css({height:"100%",width:"100%"});$("html").css("overflow","hidden");if(document.getElementById("TB_HideSelect")===null){$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");$("#TB_overlay").click(tb_remove);}}else{if(document.getElementById("TB_overlay")===null){$("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");$("#TB_overlay").click(tb_remove);}}
|
||||
if(tb_detectMacXFF()){$("#TB_overlay").addClass("TB_overlayMacFFBGHack");}else{$("#TB_overlay").addClass("TB_overlayBG");}
|
||||
if(caption===null){caption="";}
|
||||
$("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");$('#TB_load').show();var baseURL;if(url.indexOf("?")!==-1){baseURL=url.substr(0,url.indexOf("?"));}else{baseURL=url;}
|
||||
var urlString=/\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;var urlType=baseURL.toLowerCase().match(urlString);if(urlType=='.jpg'||urlType=='.jpeg'||urlType=='.png'||urlType=='.gif'||urlType=='.bmp'){TB_PrevCaption="";TB_PrevURL="";TB_PrevHTML="";TB_NextCaption="";TB_NextURL="";TB_NextHTML="";TB_imageCount="";TB_FoundURL=false;if(imageGroup){TB_TempArray=$("a[@rel="+imageGroup+"]").get();for(TB_Counter=0;((TB_Counter<TB_TempArray.length)&&(TB_NextHTML===""));TB_Counter++){var urlTypeTemp=TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);if(!(TB_TempArray[TB_Counter].href==url)){if(TB_FoundURL){TB_NextCaption=TB_TempArray[TB_Counter].title;TB_NextURL=TB_TempArray[TB_Counter].href;TB_NextHTML="<span id='TB_next'> <a href='#'>"+ThickboxI18nNext+"</a></span>";}else{TB_PrevCaption=TB_TempArray[TB_Counter].title;TB_PrevURL=TB_TempArray[TB_Counter].href;TB_PrevHTML="<span id='TB_prev'> <a href='#'>"+ThickboxI18nPrev+"</a></span>";}}else{TB_FoundURL=true;TB_imageCount=ThickboxI18nImage+' '+(TB_Counter+1)+' '+ThickboxI18nOf+' '+(TB_TempArray.length);}}}
|
||||
imgPreloader=new Image();imgPreloader.onload=function(){imgPreloader.onload=null;var pagesize=tb_getPageSize();var x=pagesize[0]-150;var y=pagesize[1]-150;var imageWidth=imgPreloader.width;var imageHeight=imgPreloader.height;if(imageWidth>x){imageHeight=imageHeight*(x/imageWidth);imageWidth=x;if(imageHeight>y){imageWidth=imageWidth*(y/imageHeight);imageHeight=y;}}else if(imageHeight>y){imageWidth=imageWidth*(y/imageHeight);imageHeight=y;if(imageWidth>x){imageHeight=imageHeight*(x/imageWidth);imageWidth=x;}}
|
||||
TB_WIDTH=imageWidth+30;TB_HEIGHT=imageHeight+60;$("#TB_window").append("<img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/>"+"<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>"+TB_imageCount+TB_PrevHTML+TB_NextHTML+"</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='"+ThickboxI18nClose+"'>"+ThickboxI18nClose+"</a> "+ThickboxI18nOrEscKey+"</div>");$("#TB_closeWindowButton").click(tb_remove);if(!(TB_PrevHTML==="")){function goPrev(){if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);}
|
||||
$("#TB_window").remove();$("body").append("<div id='TB_window'></div>");tb_show(TB_PrevCaption,TB_PrevURL,imageGroup);return false;}
|
||||
$("#TB_prev").click(goPrev);}
|
||||
if(!(TB_NextHTML==="")){function goNext(){$("#TB_window").remove();$("body").append("<div id='TB_window'></div>");tb_show(TB_NextCaption,TB_NextURL,imageGroup);return false;}
|
||||
$("#TB_next").click(goNext);}
|
||||
document.onkeydown=function(e){if(e==null){keycode=event.keyCode;}else{keycode=e.which;}
|
||||
if(keycode==27){tb_remove();}else if(keycode==190){if(!(TB_NextHTML=="")){document.onkeydown="";goNext();}}else if(keycode==188){if(!(TB_PrevHTML=="")){document.onkeydown="";goPrev();}}};tb_position();$("#TB_load").remove();$("#TB_Image").click(tb_remove);$("#TB_window").css({display:"block"});};imgPreloader.src=url;}else{var queryString=url.replace(/^[^\?]+\??/,'');var params=tb_parseQuery(queryString);TB_WIDTH=(params['width']*1)+30||630;TB_HEIGHT=(params['height']*1)+40||440;ajaxContentW=TB_WIDTH-30;ajaxContentH=TB_HEIGHT-45;if(url.indexOf('TB_iframe')!=-1){urlNoQuery=url.split('TB_');$("#TB_iframeContent").remove();if(params['modal']!="true"){$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='"+ThickboxI18nClose+"'>"+ThickboxI18nClose+"</a> "+ThickboxI18nOrEscKey+"</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW+29)+"px;height:"+(ajaxContentH+17)+"px;' > </iframe>");}else{$("#TB_overlay").unbind();$("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW+29)+"px;height:"+(ajaxContentH+17)+"px;'> </iframe>");}}else{if($("#TB_window").css("display")!="block"){if(params['modal']!="true"){$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='"+ThickboxI18nClose+"'>"+ThickboxI18nClose+"</a> "+ThickboxI18nOrEscKey+"</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");}else{$("#TB_overlay").unbind();$("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");}}else{$("#TB_ajaxContent")[0].style.width=ajaxContentW+"px";$("#TB_ajaxContent")[0].style.height=ajaxContentH+"px";$("#TB_ajaxContent")[0].scrollTop=0;$("#TB_ajaxWindowTitle").html(caption);}}
|
||||
$("#TB_closeWindowButton").click(tb_remove);if(url.indexOf('TB_inline')!=-1){$("#TB_ajaxContent").append($('#'+params['inlineId']).children());$("#TB_window").unload(function(){$('#'+params['inlineId']).append($("#TB_ajaxContent").children());});tb_position();$("#TB_load").remove();$("#TB_window").css({display:"block"});}else if(url.indexOf('TB_iframe')!=-1){tb_position();if($.browser.safari){$("#TB_load").remove();$("#TB_window").css({display:"block"});}}else{$("#TB_ajaxContent").load(url+="&random="+(new Date().getTime()),function(){tb_position();$("#TB_load").remove();tb_init("#TB_ajaxContent a.thickbox");$("#TB_window").css({display:"block"});});}}
|
||||
if(!params['modal']){document.onkeyup=function(e){if(e==null){keycode=event.keyCode;}else{keycode=e.which;}
|
||||
if(keycode==27){tb_remove();}};}}catch(e){}}
|
||||
function tb_showIframe(){$("#TB_load").remove();$("#TB_window").css({display:"block"});}
|
||||
function tb_remove(){$("#TB_imageOff").unbind("click");$("#TB_closeWindowButton").unbind("click");$("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});$("#TB_load").remove();if(typeof document.body.style.maxHeight=="undefined"){$("body","html").css({height:"auto",width:"auto"});$("html").css("overflow","");}
|
||||
document.onkeydown="";document.onkeyup="";return false;}
|
||||
function tb_position(){$("#TB_window").css({marginLeft:'-'+parseInt((TB_WIDTH/2),10)+'px',width:TB_WIDTH+'px'});if(!(jQuery.browser.msie6)){$("#TB_window").css({marginTop:'-'+parseInt((TB_HEIGHT/2),10)+'px'});}}
|
||||
function tb_parseQuery(query){var Params={};if(!query){return Params;}
|
||||
var Pairs=query.split(/[;&]/);for(var i=0;i<Pairs.length;i++){var KeyVal=Pairs[i].split('=');if(!KeyVal||KeyVal.length!=2){continue;}
|
||||
var key=unescape(KeyVal[0]);var val=unescape(KeyVal[1]);val=val.replace(/\+/g,' ');Params[key]=val;}
|
||||
return Params;}
|
||||
function tb_getPageSize(){var de=document.documentElement;var w=window.innerWidth||self.innerWidth||(de&&de.clientWidth)||document.body.clientWidth;var h=window.innerHeight||self.innerHeight||(de&&de.clientHeight)||document.body.clientHeight;arrayPageSize=[w,h];return arrayPageSize;}
|
||||
function tb_detectMacXFF(){var userAgent=navigator.userAgent.toLowerCase();if(userAgent.indexOf('mac')!=-1&&userAgent.indexOf('firefox')!=-1){return true;}}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Async Treeview 0.1 - Lazy-loading extension for Treeview
|
||||
*
|
||||
* http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
|
||||
*
|
||||
* Copyright (c) 2007 Jörn Zaefferer
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Revision: $Id: jquery.treeview.async.js 8062 2011-08-16 09:10:40Z rMalie $
|
||||
*
|
||||
*/
|
||||
|
||||
;(function($) {
|
||||
|
||||
function load(settings, root, child, container) {
|
||||
function createNode(parent) {
|
||||
var id_category = this.id_category;
|
||||
var checked = false;
|
||||
$('input[name="'+inputName+'"][type=hidden]').each( function () {
|
||||
if ($(this).attr('value') == id_category)
|
||||
{
|
||||
checked = true;
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
var current = $("<li/>").attr("id", this.id_category || "").html(" <input type=\""+(!use_radio ? 'checkbox' : 'radio')+"\" value=\""+this.id_category+"\"/ name=\""+inputName+"\" "+(checked ? 'checked' : '')+" onclick=\"clickOnCategoryBox($(this));\"/> <span class=\"category_label\">" + this.name +"</span> <span class=\"category_level\" style=\"display: none;\">" + this.level_depth +"</span> <span class=\"nb_sub_cat_selected\" style=\"font-weight: bold;"+(this.nbSelectedSubCat == 0 ? 'display: none;' : '')+"\">(<span class=\"nb_sub_cat_selected_value\">"+this.nbSelectedSubCat+"</span> "+selectedLabel+")</span>").appendTo(parent);
|
||||
if (this.classes) {
|
||||
current.children("span").addClass(this.classes);
|
||||
}
|
||||
if (this.has_children > 0) {
|
||||
var branch = $("<ul/>").hide().appendTo(current);
|
||||
current.addClass("hasChildren");
|
||||
createNode.call({
|
||||
classes: "placeholder",
|
||||
name: " ",
|
||||
children:[]
|
||||
}, branch);
|
||||
branch.children().children('.nb_sub_cat_selected').remove();
|
||||
}
|
||||
}
|
||||
$.ajax($.extend(true, {
|
||||
url: settings.url,
|
||||
dataType: "json",
|
||||
data: {
|
||||
id_category_parent: root
|
||||
},
|
||||
success: function(response) {
|
||||
child.empty();
|
||||
$.each(response, createNode, [child]);
|
||||
$(container).treeview({
|
||||
add: child
|
||||
});
|
||||
readyToExpand = true;
|
||||
}
|
||||
}, settings.ajax));
|
||||
}
|
||||
|
||||
var proxied = $.fn.treeview;
|
||||
$.fn.treeview = function(settings) {
|
||||
if (!settings.url) {
|
||||
return proxied.apply(this, arguments);
|
||||
}
|
||||
var container = this;
|
||||
if (!container.children().size())
|
||||
load(settings, "source", this, container);
|
||||
var userToggle = settings.toggle;
|
||||
return proxied.call(this, $.extend({}, settings, {
|
||||
collapsed: true,
|
||||
toggle: function() {
|
||||
var $this = $(this);
|
||||
if ($this.hasClass("hasChildren")) {
|
||||
var childList = $this.removeClass("hasChildren").find("ul");
|
||||
load(settings, this.id, childList, container);
|
||||
}
|
||||
if (userToggle) {
|
||||
userToggle.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
}));
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,73 @@
|
||||
.treeview, .treeview ul {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.treeview ul {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.treeview .hitarea {
|
||||
background: url(../img/admin/jquery-treeview/treeview-default.gif) -64px -25px no-repeat;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
margin-left: -16px;
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
/* fix for IE6 */
|
||||
* html .hitarea {
|
||||
display: inline;
|
||||
float:none;
|
||||
}
|
||||
|
||||
.treeview li {
|
||||
margin: 0;
|
||||
padding: 3px 0pt 3px 16px;
|
||||
}
|
||||
|
||||
.treeview a.selected {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
#treecontrol { margin: 1em 0; display: none; }
|
||||
|
||||
.treeview .hover { color: gray; cursor: pointer; }
|
||||
|
||||
.treeview li { background: url(../img/admin/jquery-treeview/treeview-default-line.gif) 0 0 no-repeat; }
|
||||
.treeview li.collapsable, .treeview li.expandable { background-position: 0 -176px; }
|
||||
|
||||
.treeview .expandable-hitarea { background-position: -80px -3px; }
|
||||
|
||||
.treeview li.last { background-position: 0 -1766px }
|
||||
.treeview li.lastCollapsable, .treeview li.lastExpandable { background-image: url(../img/admin/jquery-treeview/treeview-default.gif); }
|
||||
.treeview li.lastCollapsable { background-position: 0 -111px }
|
||||
.treeview li.lastExpandable { background-position: -32px -67px }
|
||||
|
||||
.treeview div.lastCollapsable-hitarea, .treeview div.lastExpandable-hitarea { background-position: 0; }
|
||||
|
||||
.treeview-red li { background-image: url(../img/admin/jquery-treeview/treeview-red-line.gif); }
|
||||
.treeview-red .hitarea, .treeview-red li.lastCollapsable, .treeview-red li.lastExpandable { background-image: url(../img/admin/jquery-treeview/treeview-red.gif); }
|
||||
|
||||
.treeview-black li { background-image: url(../img/admin/jquery-treeview/treeview-black-line.gif); }
|
||||
.treeview-black .hitarea, .treeview-black li.lastCollapsable, .treeview-black li.lastExpandable { background-image: url(../img/admin/jquery-treeview/treeview-black.gif); }
|
||||
|
||||
.treeview-gray li { background-image: url(../img/admin/jquery-treeview/treeview-gray-line.gif); }
|
||||
.treeview-gray .hitarea, .treeview-gray li.lastCollapsable, .treeview-gray li.lastExpandable { background-image: url(../img/admin/jquery-treeview/treeview-gray.gif); }
|
||||
|
||||
.treeview-famfamfam li { background-image: url(../img/admin/jquery-treeview/treeview-famfamfam-line.gif); }
|
||||
.treeview-famfamfam .hitarea, .treeview-famfamfam li.lastCollapsable, .treeview-famfamfam li.lastExpandable { background-image: url(../img/admin/jquery-treeview/treeview-famfamfam.gif); }
|
||||
|
||||
.treeview .placeholder {
|
||||
background: url(../img/admin/jquery-treeview/ajax-loader.gif) 0 0 no-repeat;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.filetree li { padding: 3px 0 2px 16px; }
|
||||
.filetree span.folder, .filetree span.file { padding: 1px 0 1px 16px; display: block; }
|
||||
.filetree span.folder { background: url(../img/admin/jquery-treeview/folder.gif) 0 0 no-repeat; }
|
||||
.filetree li.expandable span.folder { background: url(../img/admin/jquery-treeview/folder-closed.gif) 0 0 no-repeat; }
|
||||
.filetree span.file { background: url(../img/admin/jquery-treeview/file.gif) 0 0 no-repeat; }
|
||||
@@ -0,0 +1,37 @@
|
||||
(function($) {
|
||||
var CLASSES = $.treeview.classes;
|
||||
var proxied = $.fn.treeview;
|
||||
$.fn.treeview = function(settings) {
|
||||
settings = $.extend({}, settings);
|
||||
if (settings.add) {
|
||||
return this.trigger("add", [settings.add]);
|
||||
}
|
||||
if (settings.remove) {
|
||||
return this.trigger("remove", [settings.remove]);
|
||||
}
|
||||
return proxied.apply(this, arguments).bind("add", function(event, branches) {
|
||||
$(branches).prev()
|
||||
.removeClass(CLASSES.last)
|
||||
.removeClass(CLASSES.lastCollapsable)
|
||||
.removeClass(CLASSES.lastExpandable)
|
||||
.find(">.hitarea")
|
||||
.removeClass(CLASSES.lastCollapsableHitarea)
|
||||
.removeClass(CLASSES.lastExpandableHitarea);
|
||||
$(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, $(this).data("toggler"));
|
||||
}).bind("remove", function(event, branches) {
|
||||
var prev = $(branches).prev();
|
||||
var parent = $(branches).parent();
|
||||
$(branches).remove();
|
||||
prev.filter(":last-child").addClass(CLASSES.last)
|
||||
.filter("." + CLASSES.expandable).replaceClass(CLASSES.last, CLASSES.lastExpandable).end()
|
||||
.find(">.hitarea").replaceClass(CLASSES.expandableHitarea, CLASSES.lastExpandableHitarea).end()
|
||||
.filter("." + CLASSES.collapsable).replaceClass(CLASSES.last, CLASSES.lastCollapsable).end()
|
||||
.find(">.hitarea").replaceClass(CLASSES.collapsableHitarea, CLASSES.lastCollapsableHitarea);
|
||||
if (parent.is(":not(:has(>))") && parent[0] != this) {
|
||||
parent.parent().removeClass(CLASSES.collapsable).removeClass(CLASSES.expandable)
|
||||
parent.siblings(".hitarea").andSelf().remove();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,259 @@
|
||||
/*
|
||||
* Treeview 1.5pre - jQuery plugin to hide and show branches of a tree
|
||||
*
|
||||
* http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
|
||||
* http://docs.jquery.com/Plugins/Treeview
|
||||
*
|
||||
* Copyright (c) 2007 Jörn Zaefferer
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Revision: $Id: jquery.treeview.js 8151 2011-08-22 16:22:16Z rMalie $
|
||||
*
|
||||
*/
|
||||
|
||||
;(function($) {
|
||||
|
||||
// TODO rewrite as a widget, removing all the extra plugins
|
||||
$.extend($.fn, {
|
||||
swapClass: function(c1, c2) {
|
||||
var c1Elements = this.filter('.' + c1);
|
||||
this.filter('.' + c2).removeClass(c2).addClass(c1);
|
||||
c1Elements.removeClass(c1).addClass(c2);
|
||||
return this;
|
||||
},
|
||||
replaceClass: function(c1, c2) {
|
||||
return this.filter('.' + c1).removeClass(c1).addClass(c2).end();
|
||||
},
|
||||
hoverClass: function(className) {
|
||||
className = className || "hover";
|
||||
return this.hover(function() {
|
||||
$(this).addClass(className);
|
||||
}, function() {
|
||||
$(this).removeClass(className);
|
||||
});
|
||||
},
|
||||
heightToggle: function(animated, callback) {
|
||||
animated ?
|
||||
this.animate({ height: "toggle" }, animated, callback) :
|
||||
this.each(function(){
|
||||
jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
|
||||
if(callback)
|
||||
callback.apply(this, arguments);
|
||||
});
|
||||
},
|
||||
heightHide: function(animated, callback) {
|
||||
if (animated) {
|
||||
this.animate({ height: "hide" }, animated, callback);
|
||||
} else {
|
||||
this.hide();
|
||||
if (callback)
|
||||
this.each(callback);
|
||||
}
|
||||
},
|
||||
prepareBranches: function(settings) {
|
||||
if (!settings.prerendered) {
|
||||
// mark last tree items
|
||||
this.filter(":last-child:not(ul)").addClass(CLASSES.last);
|
||||
// collapse whole tree, or only those marked as closed, anyway except those marked as open
|
||||
this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide();
|
||||
}
|
||||
// return all items with sublists
|
||||
return this.filter(":has(>ul)");
|
||||
},
|
||||
applyClasses: function(settings, toggler) {
|
||||
// TODO use event delegation
|
||||
this.filter(":has(>ul):not(:has(>a))").find(">span").unbind("click.treeview").bind("click.treeview", function(event) {
|
||||
// don't handle click events on children, eg. checkboxes
|
||||
if ( this == event.target )
|
||||
toggler.apply($(this).next());
|
||||
}).add( $("a", this) ).hoverClass();
|
||||
|
||||
if (!settings.prerendered) {
|
||||
// handle closed ones first
|
||||
this.filter(":has(>ul:hidden)")
|
||||
.addClass(CLASSES.expandable)
|
||||
.replaceClass(CLASSES.last, CLASSES.lastExpandable);
|
||||
|
||||
// handle open ones
|
||||
this.not(":has(>ul:hidden)")
|
||||
.addClass(CLASSES.collapsable)
|
||||
.replaceClass(CLASSES.last, CLASSES.lastCollapsable);
|
||||
|
||||
// create hitarea if not present
|
||||
var hitarea = this.find("div." + CLASSES.hitarea);
|
||||
if (!hitarea.length)
|
||||
hitarea = this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea);
|
||||
hitarea.removeClass().addClass(CLASSES.hitarea).each(function() {
|
||||
var classes = "";
|
||||
$.each($(this).parent().attr("class").split(" "), function() {
|
||||
classes += this + "-hitarea ";
|
||||
});
|
||||
$(this).addClass( classes );
|
||||
})
|
||||
}
|
||||
|
||||
// apply event to hitarea
|
||||
this.find("div." + CLASSES.hitarea).click( toggler );
|
||||
},
|
||||
treeview: function(settings) {
|
||||
|
||||
settings = $.extend({
|
||||
cookieId: "treeview"
|
||||
}, settings);
|
||||
|
||||
if ( settings.toggle ) {
|
||||
var callback = settings.toggle;
|
||||
settings.toggle = function() {
|
||||
return callback.apply($(this).parent()[0], arguments);
|
||||
};
|
||||
}
|
||||
|
||||
// factory for treecontroller
|
||||
function treeController(tree, control) {
|
||||
// factory for click handlers
|
||||
function handler(filter) {
|
||||
return function() {
|
||||
// reuse toggle event handler, applying the elements to toggle
|
||||
// start searching for all hitareas
|
||||
toggler.apply( $("div." + CLASSES.hitarea, tree).filter(function() {
|
||||
// for plain toggle, no filter is provided, otherwise we need to check the parent element
|
||||
return filter ? $(this).parent("." + filter).length : true;
|
||||
}) );
|
||||
return false;
|
||||
};
|
||||
}
|
||||
// click on first element to collapse tree
|
||||
$("a:eq(0)", control).click( handler(CLASSES.collapsable) );
|
||||
// click on second to expand tree
|
||||
$("a:eq(1)", control).click( handler(CLASSES.expandable) );
|
||||
// click on third to toggle tree
|
||||
$("a:eq(2)", control).click( handler() );
|
||||
}
|
||||
|
||||
// handle toggle event
|
||||
function toggler() {
|
||||
// Added by Prestashop
|
||||
if ($(this).parent().is('.static'))
|
||||
return;
|
||||
$(this)
|
||||
.parent()
|
||||
// swap classes for hitarea
|
||||
.find(">.hitarea")
|
||||
.swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
|
||||
.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
|
||||
.end()
|
||||
// swap classes for parent li
|
||||
.swapClass( CLASSES.collapsable, CLASSES.expandable )
|
||||
.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
|
||||
// find child lists
|
||||
.find( ">ul" )
|
||||
// toggle them
|
||||
.heightToggle( settings.animated, settings.toggle );
|
||||
if ( settings.unique ) {
|
||||
$(this).parent()
|
||||
.siblings()
|
||||
// swap classes for hitarea
|
||||
.find(">.hitarea")
|
||||
.replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
|
||||
.replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
|
||||
.end()
|
||||
.replaceClass( CLASSES.collapsable, CLASSES.expandable )
|
||||
.replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
|
||||
.find( ">ul" )
|
||||
.heightHide( settings.animated, settings.toggle );
|
||||
}
|
||||
}
|
||||
this.data("toggler", toggler);
|
||||
|
||||
function serialize() {
|
||||
function binary(arg) {
|
||||
return arg ? 1 : 0;
|
||||
}
|
||||
var data = [];
|
||||
branches.each(function(i, e) {
|
||||
data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0;
|
||||
});
|
||||
$.cookie(settings.cookieId, data.join(""), settings.cookieOptions );
|
||||
}
|
||||
|
||||
function deserialize() {
|
||||
var stored = $.cookie(settings.cookieId);
|
||||
if ( stored ) {
|
||||
var data = stored.split("");
|
||||
branches.each(function(i, e) {
|
||||
$(e).find(">ul")[ parseInt(data[i]) ? "show" : "hide" ]();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// add treeview class to activate styles
|
||||
this.addClass("treeview");
|
||||
|
||||
// prepare branches and find all tree items with child lists
|
||||
var branches = this.find("li").prepareBranches(settings);
|
||||
|
||||
switch(settings.persist) {
|
||||
case "cookie":
|
||||
var toggleCallback = settings.toggle;
|
||||
settings.toggle = function() {
|
||||
serialize();
|
||||
if (toggleCallback) {
|
||||
toggleCallback.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
deserialize();
|
||||
break;
|
||||
case "location":
|
||||
var current = this.find("a").filter(function() {
|
||||
return this.href.toLowerCase() == location.href.toLowerCase();
|
||||
});
|
||||
if ( current.length ) {
|
||||
// TODO update the open/closed classes
|
||||
var items = current.addClass("selected").parents("ul, li").add( current.next() ).show();
|
||||
if (settings.prerendered) {
|
||||
// if prerendered is on, replicate the basic class swapping
|
||||
items.filter("li")
|
||||
.swapClass( CLASSES.collapsable, CLASSES.expandable )
|
||||
.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
|
||||
.find(">.hitarea")
|
||||
.swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
|
||||
.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
branches.applyClasses(settings, toggler);
|
||||
|
||||
// if control option is set, create the treecontroller and show it
|
||||
if ( settings.control ) {
|
||||
treeController(this, settings.control);
|
||||
$(settings.control).show();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
// classes used by the plugin
|
||||
// need to be styled via external stylesheet, see first example
|
||||
$.treeview = {};
|
||||
var CLASSES = ($.treeview.classes = {
|
||||
open: "open",
|
||||
closed: "closed",
|
||||
expandable: "expandable",
|
||||
expandableHitarea: "expandable-hitarea",
|
||||
lastExpandableHitarea: "lastExpandable-hitarea",
|
||||
collapsable: "collapsable",
|
||||
collapsableHitarea: "collapsable-hitarea",
|
||||
lastCollapsableHitarea: "lastCollapsable-hitarea",
|
||||
lastCollapsable: "lastCollapsable",
|
||||
lastExpandable: "lastExpandable",
|
||||
last: "last",
|
||||
hitarea: "hitarea"
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,378 @@
|
||||
/*
|
||||
* jQuery UI Sortable
|
||||
*
|
||||
* Copyright (c) 2008 Paul Bakaus
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
* http://docs.jquery.com/UI/Sortables
|
||||
*
|
||||
* Depends:
|
||||
* ui.base.js
|
||||
*
|
||||
* Revision: $Id: jquery.treeview.sortable.js 7776 2011-07-28 09:20:57Z rMalie $
|
||||
*/
|
||||
;(function($) {
|
||||
|
||||
if (window.Node && Node.prototype && !Node.prototype.contains) {
|
||||
Node.prototype.contains = function (arg) {
|
||||
return !!(this.compareDocumentPosition(arg) & 16);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
$.widget("ui.sortableTree", $.extend($.ui.mouse, {
|
||||
init: function() {
|
||||
|
||||
//Initialize needed constants
|
||||
var self = this, o = this.options;
|
||||
this.containerCache = {};
|
||||
this.element.addClass("ui-sortableTree");
|
||||
|
||||
//Get the items
|
||||
this.refresh();
|
||||
|
||||
//Let's determine the parent's offset
|
||||
if(!(/(relative|absolute|fixed)/).test(this.element.css('position'))) this.element.css('position', 'relative');
|
||||
this.offset = this.element.offset();
|
||||
|
||||
//Initialize mouse events for interaction
|
||||
this.mouseInit();
|
||||
|
||||
//Prepare cursorAt
|
||||
if(o.cursorAt && o.cursorAt.constructor == Array)
|
||||
o.cursorAt = { left: o.cursorAt[0], top: o.cursorAt[1] };
|
||||
|
||||
},
|
||||
plugins: {},
|
||||
ui: function(inst) {
|
||||
return {
|
||||
helper: (inst || this)["helper"],
|
||||
position: (inst || this)["position"].current,
|
||||
absolutePosition: (inst || this)["position"].absolute,
|
||||
instance: this,
|
||||
options: this.options,
|
||||
element: this.element,
|
||||
item: (inst || this)["currentItem"],
|
||||
sender: inst ? inst.element : null
|
||||
};
|
||||
},
|
||||
propagate: function(n,e,inst) {
|
||||
$.ui.plugin.call(this, n, [e, this.ui(inst)]);
|
||||
this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this.ui(inst)], this.options[n]);
|
||||
},
|
||||
serialize: function(o) {
|
||||
|
||||
var items = $(this.options.items, this.element).not('.ui-sortableTree-helper'); //Only the items of the sortable itself
|
||||
var str = []; o = o || {};
|
||||
|
||||
items.each(function() {
|
||||
var res = ($(this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
|
||||
if(res) str.push((o.key || res[1])+'[]='+(o.key ? res[1] : res[2]));
|
||||
});
|
||||
|
||||
return str.join('&');
|
||||
|
||||
},
|
||||
toArray: function(attr) {
|
||||
var items = $(this.options.items, this.element).not('.ui-sortableTree-helper'); //Only the items of the sortable itself
|
||||
var ret = [];
|
||||
|
||||
items.each(function() { ret.push($(this).attr(attr || 'id')); });
|
||||
return ret;
|
||||
},
|
||||
enable: function() {
|
||||
this.element.removeClass("ui-sortableTree-disabled");
|
||||
this.options.disabled = false;
|
||||
},
|
||||
disable: function() {
|
||||
this.element.addClass("ui-sortableTree-disabled");
|
||||
this.options.disabled = true;
|
||||
},
|
||||
/* Be careful with the following core functions */
|
||||
intersectsWith: function(item) {
|
||||
|
||||
var x1 = this.position.absolute.left - 10, x2 = x1 + 10,
|
||||
y1 = this.position.absolute.top - 10, y2 = y1 + 10;
|
||||
var l = item.left, r = l + item.width,
|
||||
t = item.top, b = t + item.height;
|
||||
|
||||
return ( l < x1 + (this.helperProportions.width / 2) // Right Half
|
||||
&& x2 - (this.helperProportions.width / 2) < r // Left Half
|
||||
&& t < y1 + (this.helperProportions.height / 2) // Bottom Half
|
||||
&& y2 - (this.helperProportions.height / 2) < b ); // Top Half
|
||||
|
||||
},
|
||||
intersectsWithEdge: function(item) {
|
||||
var y1 = this.position.absolute.top - 10, y2 = y1 + 10;
|
||||
var t = item.top, b = t + item.height;
|
||||
|
||||
if(!this.intersectsWith(item.item.parents(".ui-sortableTree").data("sortableTree").containerCache)) return false;
|
||||
|
||||
if (!( t < y1 + (this.helperProportions.height / 2) // Bottom Half
|
||||
&& y2 - (this.helperProportions.height / 2) < b )) return false; // Top Half
|
||||
|
||||
if(y2 > t && y1 < t) return 1; //Crosses top edge
|
||||
if(y1 < b && y2 > b) return 2; //Crosses bottom edge
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
refresh: function() {
|
||||
this.refreshItems();
|
||||
this.refreshPositions();
|
||||
},
|
||||
refreshItems: function() {
|
||||
|
||||
this.items = [];
|
||||
this.containers = [this];
|
||||
var items = this.items;
|
||||
var queries = [$(this.options.items, this.element)];
|
||||
|
||||
if(this.options.connectWith) {
|
||||
for (var i = this.options.connectWith.length - 1; i >= 0; i--){
|
||||
var cur = $(this.options.connectWith[i]);
|
||||
for (var j = cur.length - 1; j >= 0; j--){
|
||||
var inst = $.data(cur[j], 'sortableTree');
|
||||
if(inst && !inst.options.disabled) {
|
||||
queries.push($(inst.options.items, inst.element));
|
||||
this.containers.push(inst);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
for (var i = queries.length - 1; i >= 0; i--){
|
||||
queries[i].each(function() {
|
||||
$.data(this, 'sortableTree-item', true); // Data for target checking (mouse manager)
|
||||
items.push({
|
||||
item: $(this),
|
||||
width: 0, height: 0,
|
||||
left: 0, top: 0
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
},
|
||||
refreshPositions: function(fast) {
|
||||
for (var i = this.items.length - 1; i >= 0; i--){
|
||||
if(!fast) this.items[i].height = this.items[i].item.outerHeight();
|
||||
this.items[i].top = this.items[i].item.offset().top;
|
||||
};
|
||||
for (var i = this.containers.length - 1; i >= 0; i--){
|
||||
var p =this.containers[i].element.offset();
|
||||
this.containers[i].containerCache.left = p.left;
|
||||
this.containers[i].containerCache.top = p.top;
|
||||
this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
|
||||
this.containers[i].containerCache.height= this.containers[i].element.outerHeight();
|
||||
};
|
||||
},
|
||||
destroy: function() {
|
||||
|
||||
this.element
|
||||
.removeClass("ui-sortableTree ui-sortableTree-disabled")
|
||||
.removeData("sortableTree")
|
||||
.unbind(".sortableTree");
|
||||
this.mouseDestroy();
|
||||
|
||||
for ( var i = this.items.length - 1; i >= 0; i-- )
|
||||
this.items[i].item.removeData("sortableTree-item");
|
||||
|
||||
},
|
||||
contactContainers: function(e) {
|
||||
for (var i = this.containers.length - 1; i >= 0; i--){
|
||||
|
||||
if(this.intersectsWith(this.containers[i].containerCache)) {
|
||||
if(!this.containers[i].containerCache.over) {
|
||||
|
||||
if(this.currentContainer != this.containers[i]) {
|
||||
|
||||
//When entering a new container, we will find the item with the least distance and append our item near it
|
||||
var dist = 10000; var itemWithLeastDistance = null; var base = this.position.absolute.top;
|
||||
for (var j = this.items.length - 1; j >= 0; j--) {
|
||||
if(!this.containers[i].element[0].contains(this.items[j].item[0])) continue;
|
||||
var cur = this.items[j].top;
|
||||
if(Math.abs(cur - base) < dist) {
|
||||
dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
|
||||
}
|
||||
}
|
||||
|
||||
itemWithLeastDistance ? this.rearrange(e, itemWithLeastDistance) : this.rearrange(e, null, this.containers[i].element);
|
||||
this.propagate("change", e); //Call plugins and callbacks
|
||||
this.containers[i].propagate("change", e, this); //Call plugins and callbacks
|
||||
this.currentContainer = this.containers[i];
|
||||
|
||||
}
|
||||
|
||||
this.containers[i].propagate("over", e, this);
|
||||
this.containers[i].containerCache.over = 1;
|
||||
}
|
||||
} else {
|
||||
if(this.containers[i].containerCache.over) {
|
||||
this.containers[i].propagate("out", e, this);
|
||||
this.containers[i].containerCache.over = 0;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
},
|
||||
mouseStart: function(e,el) {
|
||||
|
||||
if(this.options.disabled || this.options.type == 'static') return false;
|
||||
|
||||
//Find out if the clicked node (or one of its parents) is a actual item in this.items
|
||||
var currentItem = null, nodes = $(e.target).parents().each(function() {
|
||||
if($.data(this, 'sortableTree-item')) {
|
||||
currentItem = $(this);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if($.data(e.target, 'sortableTree-item')) currentItem = $(e.target);
|
||||
|
||||
if(!currentItem) return false;
|
||||
if(this.options.handle) {
|
||||
var validHandle = false;
|
||||
$(this.options.handle, currentItem).each(function() { if(this == e.target) validHandle = true; });
|
||||
if(!validHandle) return false;
|
||||
}
|
||||
|
||||
this.currentItem = currentItem;
|
||||
|
||||
var o = this.options;
|
||||
this.currentContainer = this;
|
||||
this.refresh();
|
||||
|
||||
//Create and append the visible helper
|
||||
this.helper = typeof o.helper == 'function' ? $(o.helper.apply(this.element[0], [e, this.currentItem])) : this.currentItem.clone();
|
||||
if(!this.helper.parents('body').length) this.helper.appendTo("body"); //Add the helper to the DOM if that didn't happen already
|
||||
this.helper.css({ position: 'absolute', clear: 'both' }).addClass('ui-sortableTree-helper'); //Position it absolutely and add a helper class
|
||||
|
||||
//Prepare variables for position generation
|
||||
$.extend(this, {
|
||||
offsetParent: this.helper.offsetParent(),
|
||||
offsets: { absolute: this.currentItem.offset() }
|
||||
});
|
||||
|
||||
//Save the first time position
|
||||
$.extend(this, {
|
||||
position: {
|
||||
current: { left: e.pageX, top: e.pageY },
|
||||
absolute: { left: e.pageX, top: e.pageY },
|
||||
dom: this.currentItem.prev()[0]
|
||||
},
|
||||
clickOffset: { left: -5, top: -5 }
|
||||
});
|
||||
|
||||
this.propagate("start", e); //Call plugins and callbacks
|
||||
this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() }; //Save and store the helper proportions
|
||||
|
||||
for (var i = this.containers.length - 1; i >= 0; i--) {
|
||||
this.containers[i].propagate("activate", e, this);
|
||||
} //Post 'activate' events to possible containers
|
||||
|
||||
//Prepare possible droppables
|
||||
if($.ui.ddmanager) $.ui.ddmanager.current = this;
|
||||
if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);
|
||||
|
||||
this.dragging = true;
|
||||
return true;
|
||||
|
||||
},
|
||||
mouseStop: function(e) {
|
||||
|
||||
if(this.newPositionAt) this.options.sortIndication.remove.call(this.currentItem, this.newPositionAt); //remove sort indicator
|
||||
this.propagate("stop", e); //Call plugins and trigger callbacks
|
||||
|
||||
//If we are using droppables, inform the manager about the drop
|
||||
var dropped = ($.ui.ddmanager && !this.options.dropBehaviour) ? $.ui.ddmanager.drop(this, e) : false;
|
||||
if(!dropped && this.newPositionAt) this.newPositionAt[this.direction == 'down' ? 'before' : 'after'](this.currentItem); //Append to element to its new position
|
||||
|
||||
if(this.position.dom != this.currentItem.prev()[0]) this.propagate("update", e); //Trigger update callback if the DOM position has changed
|
||||
if(!this.element[0].contains(this.currentItem[0])) { //Node was moved out of the current element
|
||||
this.propagate("remove", e);
|
||||
for (var i = this.containers.length - 1; i >= 0; i--){
|
||||
if(this.containers[i].element[0].contains(this.currentItem[0])) {
|
||||
this.containers[i].propagate("update", e, this);
|
||||
this.containers[i].propagate("receive", e, this);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//Post events to containers
|
||||
for (var i = this.containers.length - 1; i >= 0; i--){
|
||||
this.containers[i].propagate("deactivate", e, this);
|
||||
if(this.containers[i].containerCache.over) {
|
||||
this.containers[i].propagate("out", e, this);
|
||||
this.containers[i].containerCache.over = 0;
|
||||
}
|
||||
}
|
||||
|
||||
this.dragging = false;
|
||||
if(this.cancelHelperRemoval) return false;
|
||||
this.helper.remove();
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
mouseDrag: function(e) {
|
||||
|
||||
//Compute the helpers position
|
||||
this.position.current = { top: e.pageY + 5, left: e.pageX + 5 };
|
||||
this.position.absolute = { left: e.pageX + 5, top: e.pageY + 5 };
|
||||
|
||||
//Interconnect with droppables
|
||||
if($.ui.ddmanager) $.ui.ddmanager.drag(this, e);
|
||||
var intersectsWithDroppable = false;
|
||||
$.each($.ui.ddmanager.droppables, function() {
|
||||
if(this.isover) intersectsWithDroppable = true;
|
||||
});
|
||||
|
||||
//Rearrange
|
||||
if(intersectsWithDroppable) {
|
||||
if(this.newPositionAt) this.options.sortIndication.remove.call(this.currentItem, this.newPositionAt);
|
||||
} else {
|
||||
for (var i = this.items.length - 1; i >= 0; i--) {
|
||||
|
||||
if(this.currentItem[0].contains(this.items[i].item[0])) continue;
|
||||
|
||||
var intersection = this.intersectsWithEdge(this.items[i]);
|
||||
if(!intersection) continue;
|
||||
|
||||
this.direction = intersection == 1 ? "down" : "up";
|
||||
this.rearrange(e, this.items[i]);
|
||||
this.propagate("change", e); //Call plugins and callbacks
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Post events to containers
|
||||
this.contactContainers(e);
|
||||
|
||||
this.propagate("sort", e); //Call plugins and callbacks
|
||||
this.helper.css({ left: this.position.current.left+'px', top: this.position.current.top+'px' }); // Stick the helper to the cursor
|
||||
return false;
|
||||
|
||||
},
|
||||
rearrange: function(e, i, a) {
|
||||
if(i) {
|
||||
if(this.newPositionAt) this.options.sortIndication.remove.call(this.currentItem, this.newPositionAt);
|
||||
this.newPositionAt = i.item;
|
||||
this.options.sortIndication[this.direction].call(this.currentItem, this.newPositionAt);
|
||||
} else {
|
||||
//Append
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
$.extend($.ui.sortableTree, {
|
||||
defaults: {
|
||||
items: '> *',
|
||||
zIndex: 1000,
|
||||
distance: 1
|
||||
},
|
||||
getter: "serialize toArray"
|
||||
});
|
||||
|
||||
|
||||
|
||||
})(jQuery);
|
||||