|
|
|
/* ===========================================================
|
|
|
|
* forked from bootstrap-confirmation.js
|
|
|
|
* http://ethaizone.github.io/Bootstrap-Confirmation/
|
|
|
|
* ===========================================================
|
|
|
|
* Copyright 2013 Nimit Suwannagate <ethaizone@hotmail.com>
|
|
|
|
*
|
|
|
|
* 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 ($) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
//var for check event at body can have only one.
|
|
|
|
var event_body = false;
|
|
|
|
|
|
|
|
// CONFIRMATION PUBLIC CLASS DEFINITION
|
|
|
|
// ===============================
|
|
|
|
var Confirmation = function (element, options) {
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
this.init('confirmation', element, options);
|
|
|
|
|
|
|
|
|
|
|
|
$(element).on('show.bs.confirmation', function(e) {
|
|
|
|
that.options.onShow(e, this);
|
|
|
|
|
|
|
|
$(this).addClass('open');
|
|
|
|
|
|
|
|
var options = that.options;
|
|
|
|
var all = options.all_selector;
|
|
|
|
|
|
|
|
if(options.singleton) {
|
|
|
|
$(all+'.in').not(that.$element).confirmation('hide');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$(element).on('hide.bs.confirmation', function(e) {
|
|
|
|
that.options.onHide(e, this);
|
|
|
|
|
|
|
|
$(this).removeClass('open');
|
|
|
|
});
|
|
|
|
|
|
|
|
$(element).on('shown.bs.confirmation', function(e) {
|
|
|
|
var options = that.options;
|
|
|
|
var all = options.all_selector;
|
|
|
|
|
|
|
|
that.$element.on('click.dismiss.bs.confirmation', '[data-dismiss="confirmation"]', $.proxy(that.hide, that));
|
|
|
|
|
|
|
|
if(that.isPopout()) {
|
|
|
|
if(!event_body) {
|
|
|
|
event_body = $('body').on('click', function (e) {
|
|
|
|
if(that.$element.is(e.target)) return;
|
|
|
|
if(that.$element.has(e.target).length) return;
|
|
|
|
if($('.popover').has(e.target).length) return;
|
|
|
|
|
|
|
|
that.$element.confirmation('hide');
|
|
|
|
|
|
|
|
$('body').unbind(e);
|
|
|
|
|
|
|
|
event_body = false;
|
|
|
|
|
|
|
|
return;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$(element).on('click', function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$.fn.popover || !$.fn.tooltip) throw new Error('Confirmation requires popover.js and tooltip.js');
|
|
|
|
|
|
|
|
Confirmation.DEFAULTS = $.extend({}, $.fn.popover.Constructor.DEFAULTS, {
|
|
|
|
placement : 'top',
|
|
|
|
title : 'Are you sure?',
|
|
|
|
btnOkClass : 'btn btn-danger btn-sm',
|
|
|
|
btnOkLabel : 'Yes',
|
|
|
|
btnOkIcon : '',
|
|
|
|
btnCancelClass : 'btn btn-default btn-sm',
|
|
|
|
btnCancelLabel : 'Cancel',
|
|
|
|
btnCancelIcon : '',
|
|
|
|
href : '#',
|
|
|
|
target : '_self',
|
|
|
|
singleton : true,
|
|
|
|
popout : true,
|
|
|
|
onShow : function(event, element){},
|
|
|
|
onHide : function(event, element){},
|
|
|
|
onConfirm : function(event, element){},
|
|
|
|
onCancel : function(event, element){},
|
|
|
|
template : '<div class="popover"><div class="arrow"></div>'
|
|
|
|
+ '<h3 class="popover-title"></h3>'
|
|
|
|
+ '<div class="popover-content">'
|
|
|
|
+ '<div class="btn-group"><a data-apply="confirmation">Yes</a>'
|
|
|
|
+ ' <a data-dismiss="confirmation">No</a></div>'
|
|
|
|
+ '</div>'
|
|
|
|
+ '</div>'
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// NOTE: CONFIRMATION EXTENDS popover.js
|
|
|
|
// ================================
|
|
|
|
Confirmation.prototype = $.extend({}, $.fn.popover.Constructor.prototype);
|
|
|
|
|
|
|
|
Confirmation.prototype.constructor = Confirmation;
|
|
|
|
|
|
|
|
Confirmation.prototype.getDefaults = function () {
|
|
|
|
return Confirmation.DEFAULTS;
|
|
|
|
}
|
|
|
|
|
|
|
|
Confirmation.prototype.setContent = function () {
|
|
|
|
var that = this;
|
|
|
|
var $tip = this.tip();
|
|
|
|
var title = this.getTitle();
|
|
|
|
var $btnOk = $tip.find('[data-apply="confirmation"]');
|
|
|
|
var $btnCancel = $tip.find('[data-dismiss="confirmation"]');
|
|
|
|
var options = this.options
|
|
|
|
|
|
|
|
$btnOk.addClass(this.getBtnOkClass())
|
|
|
|
.html(this.getBtnOkLabel())
|
|
|
|
.prepend($('<i></i>').addClass(this.getBtnOkIcon()), " ")
|
|
|
|
.attr('href', this.getHref())
|
|
|
|
.attr('target', this.getTarget())
|
|
|
|
.off('click').on('click', function(event) {
|
|
|
|
options.onConfirm(event, that.$element);
|
|
|
|
|
|
|
|
that.$element.confirmation('hide');
|
|
|
|
});
|
|
|
|
|
|
|
|
$btnCancel.addClass(this.getBtnCancelClass())
|
|
|
|
.html(this.getBtnCancelLabel())
|
|
|
|
.prepend($('<i></i>').addClass(this.getBtnCancelIcon()), " ")
|
|
|
|
.off('click').on('click', function(event){
|
|
|
|
options.onCancel(event, that.$element);
|
|
|
|
|
|
|
|
that.$element.confirmation('hide');
|
|
|
|
});
|
|
|
|
|
|
|
|
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title);
|
|
|
|
|
|
|
|
$tip.removeClass('fade top bottom left right in');
|
|
|
|
|
|
|
|
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
|
|
|
|
// this manually by checking the contents.
|
|
|
|
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
Confirmation.prototype.getBtnOkClass = function () {
|
|
|
|
var $e = this.$element;
|
|
|
|
var o = this.options;
|
|
|
|
|
|
|
|
return $e.attr('data-btnOkClass') || (typeof o.btnOkClass == 'function' ? o.btnOkClass.call($e[0]) : o.btnOkClass);
|
|
|
|
}
|
|
|
|
|
|
|
|
Confirmation.prototype.getBtnOkLabel = function () {
|
|
|
|
var $e = this.$element;
|
|
|
|
var o = this.options;
|
|
|
|
|
|
|
|
return $e.attr('data-btnOkLabel') || (typeof o.btnOkLabel == 'function' ? o.btnOkLabel.call($e[0]) : o.btnOkLabel);
|
|
|
|
}
|
|
|
|
|
|
|
|
Confirmation.prototype.getBtnOkIcon = function () {
|
|
|
|
var $e = this.$element;
|
|
|
|
var o = this.options;
|
|
|
|
|
|
|
|
return $e.attr('data-btnOkIcon') || (typeof o.btnOkIcon == 'function' ? o.btnOkIcon.call($e[0]) : o.btnOkIcon);
|
|
|
|
}
|
|
|
|
|
|
|
|
Confirmation.prototype.getBtnCancelClass = function () {
|
|
|
|
var $e = this.$element;
|
|
|
|
var o = this.options;
|
|
|
|
|
|
|
|
return $e.attr('data-btnCancelClass') || (typeof o.btnCancelClass == 'function' ? o.btnCancelClass.call($e[0]) : o.btnCancelClass);
|
|
|
|
}
|
|
|
|
|
|
|
|
Confirmation.prototype.getBtnCancelLabel = function () {
|
|
|
|
var $e = this.$element;
|
|
|
|
var o = this.options;
|
|
|
|
|
|
|
|
return $e.attr('data-btnCancelLabel') || (typeof o.btnCancelLabel == 'function' ? o.btnCancelLabel.call($e[0]) : o.btnCancelLabel);
|
|
|
|
}
|
|
|
|
|
|
|
|
Confirmation.prototype.getBtnCancelIcon = function () {
|
|
|
|
var $e = this.$element;
|
|
|
|
var o = this.options;
|
|
|
|
|
|
|
|
return $e.attr('data-btnCancelIcon') || (typeof o.btnCancelIcon == 'function' ? o.btnCancelIcon.call($e[0]) : o.btnCancelIcon);
|
|
|
|
}
|
|
|
|
|
|
|
|
Confirmation.prototype.getHref = function () {
|
|
|
|
var $e = this.$element;
|
|
|
|
var o = this.options;
|
|
|
|
|
|
|
|
return $e.attr('data-href') || (typeof o.href == 'function' ? o.href.call($e[0]) : o.href);
|
|
|
|
}
|
|
|
|
|
|
|
|
Confirmation.prototype.getTarget = function () {
|
|
|
|
var $e = this.$element;
|
|
|
|
var o = this.options;
|
|
|
|
|
|
|
|
return $e.attr('data-target') || (typeof o.target == 'function' ? o.target.call($e[0]) : o.target);
|
|
|
|
}
|
|
|
|
|
|
|
|
Confirmation.prototype.isPopout = function () {
|
|
|
|
var popout;
|
|
|
|
var $e = this.$element;
|
|
|
|
var o = this.options;
|
|
|
|
|
|
|
|
popout = $e.attr('data-popout') || (typeof o.popout == 'function' ? o.popout.call($e[0]) : o.popout);
|
|
|
|
|
|
|
|
if(popout == 'false') popout = false;
|
|
|
|
|
|
|
|
return popout
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CONFIRMATION PLUGIN DEFINITION
|
|
|
|
// =========================
|
|
|
|
var old = $.fn.confirmation;
|
|
|
|
|
|
|
|
$.fn.confirmation = function (option) {
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
return this.each(function () {
|
|
|
|
var $this = $(this);
|
|
|
|
var data = $this.data('bs.confirmation');
|
|
|
|
var options = typeof option == 'object' && option;
|
|
|
|
|
|
|
|
options = options || {};
|
|
|
|
options.all_selector = that.selector;
|
|
|
|
|
|
|
|
if (!data && option == 'destroy') return;
|
|
|
|
if (!data) $this.data('bs.confirmation', (data = new Confirmation(this, options)));
|
|
|
|
if (typeof option == 'string') data[option]();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$.fn.confirmation.Constructor = Confirmation
|
|
|
|
|
|
|
|
|
|
|
|
// CONFIRMATION NO CONFLICT
|
|
|
|
// ===================
|
|
|
|
$.fn.confirmation.noConflict = function () {
|
|
|
|
$.fn.confirmation = old;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}(jQuery);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* jQuery Cookie Plugin v1.4.0
|
|
|
|
* https://github.com/carhartl/jquery-cookie
|
|
|
|
*
|
|
|
|
* Copyright 2013 Klaus Hartl
|
|
|
|
* Released under the MIT license
|
|
|
|
*/
|
|
|
|
(function(c){"function"===typeof define&&define.amd?define(["jquery"],c):c(jQuery)})(function(c){function m(b){return f.raw?b:encodeURIComponent(b)}function n(b,e){var a;if(f.raw)a=b;else a:{var d=b;0===d.indexOf('"')&&(d=d.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{d=decodeURIComponent(d.replace(l," "));a=f.json?JSON.parse(d):d;break a}catch(g){}a=void 0}return c.isFunction(e)?e(a):a}var l=/\+/g,f=c.cookie=function(b,e,a){if(void 0!==e&&!c.isFunction(e)){a=c.extend({},f.defaults,
|
|
|
|
a);if("number"===typeof a.expires){var d=a.expires,g=a.expires=new Date;g.setDate(g.getDate()+d)}return document.cookie=[m(b),"=",m(f.json?JSON.stringify(e):String(e)),a.expires?"; expires="+a.expires.toUTCString():"",a.path?"; path="+a.path:"",a.domain?"; domain="+a.domain:"",a.secure?"; secure":""].join("")}a=b?void 0:{};for(var d=document.cookie?document.cookie.split("; "):[],g=0,l=d.length;g<l;g++){var h=d[g].split("="),k;k=h.shift();k=f.raw?k:decodeURIComponent(k);h=h.join("=");if(b&&b===k){a=
|
|
|
|
n(h,e);break}b||void 0===(h=n(h))||(a[k]=h)}return a};f.defaults={};c.removeCookie=function(b,e){if(void 0===c.cookie(b))return!1;c.cookie(b,"",c.extend({},e,{expires:-1}));return!c.cookie(b)}});
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Copyright 2012 Igor Vaynberg
|
|
|
|
|
|
|
|
Version: 3.4.3 Timestamp: Tue Sep 17 06:47:14 PDT 2013
|
|
|
|
|
|
|
|
This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
|
|
|
|
General Public License version 2 (the "GPL License"). You may choose either license to govern your
|
|
|
|
use of this software only upon the condition that you accept all of the terms of either the Apache
|
|
|
|
License or the GPL License.
|
|
|
|
|
|
|
|
You may obtain a copy of the Apache License and the GPL License at:
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
http://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software distributed under the Apache License
|
|
|
|
or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
|
|
either express or implied. See the Apache License and the GPL License for the specific language governing
|
|
|
|
permissions and limitations under the Apache License and the GPL License.
|
|
|
|
*/
|
|
|
|
!function(a){"undefined"==typeof a.fn.each2&&a.extend(a.fn,{each2:function(b){for(var c=a([0]),d=-1,e=this.length;++d<e&&(c.context=c[0]=this[d])&&b.call(c[0],d,c)!==!1;);return this}})}(jQuery),function(a,b){"use strict";function n(a){var b,c,d,e;if(!a||a.length<1)return a;for(b="",c=0,d=a.length;d>c;c++)e=a.charAt(c),b+=m[e]||e;return b}function o(a,b){for(var c=0,d=b.length;d>c;c+=1)if(q(a,b[c]))return c;return-1}function p(){var b=a(l);b.appendTo("body");var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};return b.remove(),c}function q(a,c){return a===c?!0:a===b||c===b?!1:null===a||null===c?!1:a.constructor===String?a+""==c+"":c.constructor===String?c+""==a+"":!1}function r(b,c){var d,e,f;if(null===b||b.length<1)return[];for(d=b.split(c),e=0,f=d.length;f>e;e+=1)d[e]=a.trim(d[e]);return d}function s(a){return a.outerWidth(!1)-a.width()}function t(c){var d="keyup-change-value";c.on("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())}),c.on("keyup",function(){var e=a.data(c,d);e!==b&&c.val()!==e&&(a.removeData(c,d),c.trigger("keyup-change"))})}function u(c){c.on("mousemove",function(c){var d=i;(d===b||d.x!==c.pageX||d.y!==c.pageY)&&a(c.target).trigger("mousemove-filtered",c)})}function v(a,c,d){d=d||b;var e;return function(){var b=arguments;window.clearTimeout(e),e=window.setTimeout(function(){c.apply(d,b)},a)}}function w(a){var c,b=!1;return function(){return b===!1&&(c=a(),b=!0),c}}function x(a,b){var c=v(a,function(a){b.trigger("scroll-debounced",a)});b.on("scroll",function(a){o(a.target,b.get())>=0&&c(a)})}function y(a){a[0]!==document.activeElement&&window.setTimeout(function(){var d,b=a[0],c=a.val().length;a.focus(),a.is(":visible")&&b===document.activeElement&&(b.setSelectionRange?b.setSelectionRange(c,c):b.createTextRange&&(d=b.createTextRange(),d.collapse(!1),d.select()))},0)}function z(b){b=a(b)[0];var c=0,d=0;if("selectionStart"in b)c=b.selectionStart,d=b.selectionEnd-c;else if("selection"in document){b.focus();var e=document.selection.createRange();d=document.selection.createRange().text.length,e.moveStart("character",-b.value.length),c=e.text.length-d}return{offset:c,length:d}}function A(a){a.preventDefault(),a.stopPropagation()}function B(a){a.preventDefault(),a.stopImmediatePropagation()}function C(b){if(!h){var c=b[0].currentStyle||window.getComputedStyle(b[0],null);h=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),h.attr("class","select2-sizer"),a("body").append(h)}return h.text(b.val()),h.width()}function D(b,c,d){var e,g,f=[];e=b.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0===this.indexOf("select2-")&&f.push(this)})),e=c.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0!==this.indexOf("select2-")&&(g=d(this),g&&f.push(this))})),b.attr("class",f.join(" "))}function E(a,b,c,d){var e=n(a.toUpperCase()).indexOf(n(b.toUpperCase())),f=b.length;return 0>e?(c.push(d(a)),void 0):(c.push(d(a.substring(0,e))),c.push("<span class='select2-match'>"),c.push(d(a.substring(e,e+f))),c.push("</span>"),c.push(d(a.substring(e+f,a.length))),void 0)}function F(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})}function G(c){var d,e=null,f=c.quietMillis||100,g=c.url,h=this;return function(i){window.clearTimeout(d),d=window.setTimeout(function(){var d=c.data,f=g,j=c.transport||a.fn.select2.ajaxDefaults.transport,k={type:c.type||"GET",cache:c.cache||!1,jsonpCallback:c.jsonpCallback||b,dataType:c.dataType||"json"},l=a.extend({},a.fn.select2.ajaxDefaults.params,k);d=d?d.call(h,i.term,i.page,i.context):null,f="function"==typeof f?f.call(h,i.term,i.page,i.context):f,e&&e.abort(),c.params&&(a.isFunction(c.params)?a.extend(l,c.params.call(h)):a.extend(l,c.params)),a.extend(l,{url:f,dataType:c.dataType,data:d,success:function(a){var b=c.results(
|
|
|
|
f.formatSearching&&0===this.findHighlightableChoices().length&&n("<li class='select2-searching'>"+f.formatSearching()+"</li>"),d.addClass("select2-active"),this.removeHighlight(),i=this.tokenize(),i!=b&&null!=i&&d.val(i),this.resultsPage=1,f.query({element:f.element,term:d.val(),page:this.resultsPage,context:null,matcher:f.matcher,callback:this.bind(function(g){var i;if(l==this.queryCount){if(!this.opened())return this.search.removeClass("select2-active"),void 0;if(this.context=g.context===b?null:g.context,this.opts.createSearchChoice&&""!==d.val()&&(i=this.opts.createSearchChoice.call(h,d.val(),g.results),i!==b&&null!==i&&h.id(i)!==b&&null!==h.id(i)&&0===a(g.results).filter(function(){return q(h.id(this),h.id(i))}).length&&g.results.unshift(i)),0===g.results.length&&J(f.formatNoMatches,"formatNoMatches"))return n("<li class='select2-no-results'>"+f.formatNoMatches(d.val())+"</li>"),void 0;e.empty(),h.opts.populateResults.call(this,e,g.results,{term:d.val(),page:this.resultsPage,context:null}),g.more===!0&&J(f.formatLoadMore,"formatLoadMore")&&(e.append("<li class='select2-more-results'>"+h.opts.escapeMarkup(f.formatLoadMore(this.resultsPage))+"</li>"),window.setTimeout(function(){h.loadMoreIfNeeded()},10)),this.postprocessResults(g,c),m(),this.opts.element.trigger({type:"select2-loaded",items:g})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){y(this.search)},selectHighlighted:function(a){var b=this.highlight(),c=this.results.find(".select2-highlighted"),d=c.closest(".select2-result").data("select2-data");d?(this.highlight(b),this.onSelect(d,a)):a&&a.noFocus&&this.close()},getPlaceholder:function(){var a;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((a=this.getPlaceholderOption())!==b?a.text():b)},getPlaceholderOption:function(){if(this.select){var a=this.select.children().first();if(this.opts.placeholderOption!==b)return"first"===this.opts.placeholderOption&&a||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===a.text()&&""===a.val())return a}},initContainerWidth:function(){function c(){var c,d,e,f,g;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(c=this.opts.element.attr("style"),c!==b)for(d=c.split(";"),f=0,g=d.length;g>f;f+=1)if(e=d[f].replace(/\s/g,"").match(/[^-]width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==e&&e.length>=1)return e[1];return"resolve"===this.opts.width?(c=this.opts.element.css("width"),c.indexOf("%")>0?c:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return a.isFunction(this.opts.width)?this.opts.width():this.opts.width}var d=c.call(this);null!==d&&this.container.css("width",d)}}),e=N(d,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' onclick='return false;' class='select2-choice' tabindex='-1'>"," <span class='select2-chosen'> </span><abbr class='select2-search-choice-close'></abbr>"," <span class='select2-arrow'><b></b></span>","</a>","<input class='select2-focusser select2-offscreen' type='text'/>","<div class='select2-drop select2-display-none'>"," <div class='select2-search'>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'/>"," </div>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return b},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop(
|
|
|
|
|
|
|
|
(function($){
|
|
|
|
switch($.cookie("lang")){
|
|
|
|
case "zh-CN":
|
|
|
|
// Select2 Chinese translation
|
|
|
|
(function(c){c.extend(c.fn.select2.defaults,{formatNoMatches:function(){return"\u6ca1\u6709\u627e\u5230\u5339\u914d\u9879"},formatInputTooShort:function(a,b){return"\u8bf7\u518d\u8f93\u5165"+(b-a.length)+"\u4e2a\u5b57\u7b26"},formatInputTooLong:function(a,b){return"\u8bf7\u5220\u6389"+(a.length-b)+"\u4e2a\u5b57\u7b26"},formatSelectionTooBig:function(a){return"\u4f60\u53ea\u80fd\u9009\u62e9\u6700\u591a"+a+"\u9879"},formatLoadMore:function(a){return"\u52a0\u8f7d\u7ed3\u679c\u4e2d..."},formatSearching:function(){return"\u641c\u7d22\u4e2d..."}})})(jQuery);
|
|
|
|
break
|
|
|
|
case "zh-TW":
|
|
|
|
// Select2 Traditional Chinese translation
|
|
|
|
(function(c){c.extend(c.fn.select2.defaults,{formatNoMatches:function(){return"\u6c92\u6709\u627e\u5230\u76f8\u7b26\u7684\u9805\u76ee"},formatInputTooShort:function(a,b){return"\u8acb\u518d\u8f38\u5165"+(b-a.length)+"\u500b\u5b57\u5143"},formatInputTooLong:function(a,b){return"\u8acb\u522a\u6389"+(a.length-b)+"\u500b\u5b57\u5143"},formatSelectionTooBig:function(a){return"\u4f60\u53ea\u80fd\u9078\u64c7\u6700\u591a"+a+"\u9805"},formatLoadMore:function(a){return"\u8f09\u5165\u4e2d..."},formatSearching:function(){return"\u641c\u5c0b\u4e2d..."}})})(jQuery);
|
|
|
|
}
|
|
|
|
})(jQuery);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Autosize v1.17.8 - 2013-09-07
|
|
|
|
Automatically adjust textarea height based on user input.
|
|
|
|
(c) 2013 Jack Moore - http://www.jacklmoore.com/autosize
|
|
|
|
license: http://www.opensource.org/licenses/mit-license.php
|
|
|
|
*/
|
|
|
|
(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(window.jQuery||window.$)})(function(e){var t,o={className:"autosizejs",append:"",callback:!1,resizeDelay:10},i='<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>',n=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],s=e(i).data("autosize",!0)[0];s.style.lineHeight="99px","99px"===e(s).css("lineHeight")&&n.push("lineHeight"),s.style.lineHeight="",e.fn.autosize=function(i){return this.length?(i=e.extend({},o,i||{}),s.parentNode!==document.body&&e(document.body).append(s),this.each(function(){function o(){var t,o;"getComputedStyle"in window?(t=window.getComputedStyle(u),o=u.getBoundingClientRect().width,e.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(e,i){o-=parseInt(t[i],10)}),s.style.width=o+"px"):s.style.width=Math.max(p.width(),0)+"px"}function a(){var a={};if(t=u,s.className=i.className,d=parseInt(p.css("maxHeight"),10),e.each(n,function(e,t){a[t]=p.css(t)}),e(s).css(a),o(),window.chrome){var r=u.style.width;u.style.width="0px",u.offsetWidth,u.style.width=r}}function r(){var e,n;t!==u?a():o(),s.value=u.value+i.append,s.style.overflowY=u.style.overflowY,n=parseInt(u.style.height,10),s.scrollTop=0,s.scrollTop=9e4,e=s.scrollTop,d&&e>d?(u.style.overflowY="scroll",e=d):(u.style.overflowY="hidden",c>e&&(e=c)),e+=f,n!==e&&(u.style.height=e+"px",w&&i.callback.call(u,u))}function l(){clearTimeout(h),h=setTimeout(function(){var e=p.width();e!==g&&(g=e,r())},parseInt(i.resizeDelay,10))}var d,c,h,u=this,p=e(u),f=0,w=e.isFunction(i.callback),z={height:u.style.height,overflow:u.style.overflow,overflowY:u.style.overflowY,wordWrap:u.style.wordWrap,resize:u.style.resize},g=p.width();p.data("autosize")||(p.data("autosize",!0),("border-box"===p.css("box-sizing")||"border-box"===p.css("-moz-box-sizing")||"border-box"===p.css("-webkit-box-sizing"))&&(f=p.outerHeight()-p.height()),c=Math.max(parseInt(p.css("minHeight"),10)-f||0,p.height()),p.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word",resize:"none"===p.css("resize")||"vertical"===p.css("resize")?"none":"horizontal"}),"onpropertychange"in u?"oninput"in u?p.on("input.autosize keyup.autosize",r):p.on("propertychange.autosize",function(){"value"===event.propertyName&&r()}):p.on("input.autosize",r),i.resizeDelay!==!1&&e(window).on("resize.autosize",l),p.on("autosize.resize",r),p.on("autosize.resizeIncludeStyle",function(){t=null,r()}),p.on("autosize.destroy",function(){t=null,clearTimeout(h),e(window).off("resize",l),p.off("autosize").off(".autosize").css(z).removeData("autosize")}),r())})):this}});
|
|
|
|
|
|
|
|
/*! jquery-textcomplete - v0.1.0 - 2013-10-28 */
|
|
|
|
!function(a){"use strict";var b=function(a){var b,d;return b=function(){d=!1},function(){var e;d||(d=!0,e=c(arguments),e.unshift(b),a.apply(this,e))}},c=function(a){var b;return b=Array.prototype.slice.call(a)},d=function(a,b){return a.bind?a.bind(b):function(){a.apply(b,arguments)}},e=function(){var b;return b=a("<div></div>").css(["color"]).color,"undefined"!=typeof b?function(a,b){return a.css(b)}:function(b,c){var d;return d={},a.each(c,function(a,c){d[c]=b.css(c)}),d}}(),f=function(a){return a},g=function(a){var b={};return function(c,d){b[c]?d(b[c]):a.call(this,c,function(a){b[c]=(b[c]||[]).concat(a),d.apply(null,arguments)})}},h=function(a,b){var c,d;if(a.indexOf)return-1!=a.indexOf(b);for(c=0,d=a.length;d>c;c++)if(a[c]===b)return!0;return!1},i=function(){function c(b,c){var e,f,g;f=i.clone(),this.el=b.get(0),this.$el=b,e=k(this.$el),g=this.el===document.activeElement,this.$el.wrap(e).before(f),g&&this.el.focus(),this.listView=new j(f,this),this.strategies=c,this.$el.on("keyup",d(this.onKeyup,this)),this.$el.on("keydown",d(this.listView.onKeydown,this.listView)),a(document).on("click",d(function(a){a.originalEvent&&!a.originalEvent.keepTextCompleteDropdown&&this.listView.deactivate()},this))}var f,g,h,i;f={wrapper:'<div class="textcomplete-wrapper"></div>',list:'<ul class="dropdown-menu"></ul>'},g={wrapper:{position:"relative"},list:{position:"absolute",top:0,left:0,zIndex:"100",display:"none"}},h=a(f.wrapper).css(g.wrapper),i=a(f.list).css(g.list),a.extend(c.prototype,{renderList:function(a){this.clearAtNext&&(this.listView.clear(),this.clearAtNext=!1),a.length?(this.listView.shown||(this.listView.setPosition(this.getCaretPosition()).clear().activate(),this.listView.strategy=this.strategy),a=a.slice(0,this.strategy.maxCount),this.listView.render(a)):this.listView.shown&&this.listView.deactivate()},searchCallbackFactory:function(a){var b=this;return function(c,d){b.renderList(c),d||(a(),b.clearAtNext=!0)}},onKeyup:function(){var a,b;if(a=this.extractSearchQuery(this.getTextFromHeadToCaret()),a.length){if(b=a[1],this.term===b)return;this.term=b,this.search(a)}else this.term=null,this.listView.deactivate()},onSelect:function(b){var c,d,e;c=this.getTextFromHeadToCaret(),d=this.el.value.substring(this.el.selectionEnd),e=this.strategy.replace(b),a.isArray(e)&&(d=e[1]+d,e=e[0]),c=c.replace(this.strategy.match,e),this.$el.val(c+d),this.el.focus(),this.el.selectionStart=this.el.selectionEnd=c.length},getCaretPosition:function(){if(0!==this.el.selectionEnd){var b,c,d,f,g;return b=["border-width","font-family","font-size","font-style","font-variant","font-weight","height","letter-spacing","word-spacing","line-height","text-decoration","width","padding-top","padding-right","padding-bottom","padding-left","margin-top","margin-right","margin-bottom","margin-left"],c=a.extend({position:"absolute",overflow:"auto","white-space":"pre-wrap",top:0,left:-9999},e(this.$el,b)),d=a("<div></div>").css(c).text(this.getTextFromHeadToCaret()),f=a("<span></span>").text(" ").appendTo(d),this.$el.before(d),g=f.position(),g.top+=f.height()-this.$el.scrollTop(),d.remove(),g}},getTextFromHeadToCaret:function(){var a,b,c;return b=this.el.selectionEnd,"number"==typeof b?a=this.el.value.substring(0,b):document.selection&&(c=this.el.createTextRange(),c.moveStart("character",0),c.moveEnd("textedit"),a=c.text),a},extractSearchQuery:function(a){var b,c,d,e;for(b=0,c=this.strategies.length;c>b;b++)if(d=this.strategies[b],e=a.match(d.match))return[d,e[d.index]];return[]},search:b(function(a,b){var c;this.strategy=b[0],c=b[1],this.strategy.search(c,this.searchCallbackFactory(a))})});var k=function(a){return h.clone().css("display",a.css("display"))};return c}(),j=function(){function b(a,b){this.$el=a,this.index=0,this.completer=b,this.$el.on("click","li.textcomplete-item",d(this.onClick,this))}return a.extend(b.prototype,{shown:!1,render:function(a){var b,c,d,e,f;for(b="",c=0,d=a.length;d>c&&(f=a[c],h(this.data,f)||(e=this.data.length,this.data.push(f),b+='<li class="textcomplete-item" data-index="'+e+'"><a>',b+=this.strategy.template(f),b+="</a></li
|
|
|
|
|
|
|
|
/*! jquery-overlay - v0.0.2 - 2013-10-02 */
|
|
|
|
!function(a){"use strict";var b=function(a,b){return a.bind?a.bind(b):function(){a.apply(b,arguments)}},c=function(){var b;return b=a("<div></div>").css(["color"]).color,"undefined"!=typeof b?function(a,b){return a.css(b)}:function(b,c){var d;return d={},a.each(c,function(a,c){d[c]=b.css(c)}),d}}(),d={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},e=/[&<>"'\/]/g,f=function(a){return a.replace(e,function(a){return d[a]})},g=function(){function d(d,f){var j,k;k=d.css("position"),"static"===k&&(k="relative"),j=a(e.wrapper).css(a.extend({},g.wrapper,c(d,h),{position:k})),this.textareaTop=parseInt(d.css("border-top-width")),this.$el=a(e.overlay).css(a.extend({},g.overlay,c(d,i),{top:this.textareaTop,right:parseInt(d.css("border-right-width")),bottom:parseInt(d.css("border-bottom-width")),left:parseInt(d.css("border-left-width"))})),this.$textarea=d.css(g.textarea),this.$textarea.wrap(j).before(this.$el),this.$textarea.origVal=d.val,this.$textarea.val=b(this.val,this),this.$textarea.on("input",b(this.onInput,this)),this.$textarea.on("change",b(this.onInput,this)),this.$textarea.on("scroll",b(this.resizeOverlay,this)),this.$textarea.on("resize",b(this.resizeOverlay,this)),this.strategies=a.isArray(f)?f:[f],this.renderTextOnOverlay()}var e,g,h,i;return e={wrapper:'<div class="textoverlay-wrapper"></div>',overlay:'<div class="textoverlay"></div>'},g={wrapper:{margin:0,padding:0,overflow:"hidden"},overlay:{position:"absolute",color:"transparent","white-space":"pre-wrap","word-wrap":"break-word",overflow:"hidden"},textarea:{background:"transparent",position:"relative",outline:0}},h=["display"],i=["margin-top","margin-right","margin-bottom","margin-left","padding-top","padding-right","padding-bottom","padding-left","font-family","font-weight","font-size","background-color"],a.extend(d.prototype,{val:function(a){return null==a?this.$textarea.origVal():this.setVal(a)},setVal:function(a){return this.$textarea.origVal(a),this.renderTextOnOverlay()},onInput:function(){this.renderTextOnOverlay()},renderTextOnOverlay:function(){var b,c,d,e,g,h;for(b=f(this.$textarea.val()),c=0,d=this.strategies.length;d>c;c++)e=this.strategies[c],g=e.match,a.isArray(g)&&(g=a.map(g,function(a){return a.replace(/(\(|\)|\|)/g,"$1")}),g=new RegExp("("+g.join("|")+")","g")),h="background-color:"+e.css["background-color"],b=b.replace(g,function(a){return'<span style="'+h+'">'+a+"</span>"});return this.$el.html(b),this},resizeOverlay:function(){this.$el.css({top:this.textareaTop-this.$textarea.scrollTop()})}}),d}();a.fn.overlay=function(a){return new g(this,a),this}}(window.jQuery);
|
|
|
|
|
|
|
|
/* https://github.com/balupton/jquery-scrollto */
|
|
|
|
(function(){var e,h;e=window.jQuery||require("jquery");e.propHooks.scrollTop=e.propHooks.scrollLeft={get:function(a,d){var b=null;if("HTML"===a.tagName||"BODY"===a.tagName)"scrollLeft"===d?b=window.scrollX:"scrollTop"===d&&(b=window.scrollY);null==b&&(b=a[d]);return b}};e.Tween.propHooks.scrollTop=e.Tween.propHooks.scrollLeft={get:function(a){return e.propHooks.scrollTop.get(a.elem,a.prop)},set:function(a){"HTML"===a.elem.tagName||"BODY"===a.elem.tagName?(a.options.bodyScrollLeft=a.options.bodyScrollLeft||
|
|
|
|
window.scrollX,a.options.bodyScrollTop=a.options.bodyScrollTop||window.scrollY,"scrollLeft"===a.prop?a.options.bodyScrollLeft=Math.round(a.now):"scrollTop"===a.prop&&(a.options.bodyScrollTop=Math.round(a.now)),window.scrollTo(a.options.bodyScrollLeft,a.options.bodyScrollTop)):a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}};h={config:{duration:400,easing:"swing",callback:void 0,durationMode:"each",offsetTop:0,offsetLeft:0},configure:function(a){e.extend(h.config,a||{});return this},scroll:function(a,
|
|
|
|
d){var b,c,f,g,n,l,m,k,p;b=a.pop();c=b.$container;f=b.$target;c.prop("tagName");g=e("<span/>").css({position:"absolute",top:"0px",left:"0px"});n=c.css("position");c.css({position:"relative"});g.appendTo(c);b=g.offset().top;b=f.offset().top-b-parseInt(d.offsetTop,10);l=g.offset().left;m=f.offset().left-l-parseInt(d.offsetLeft,10);f=c.prop("scrollTop");l=c.prop("scrollLeft");g.remove();c.css({position:n});k={};p=function(b){0===a.length?"function"===typeof d.callback&&d.callback():h.scroll(a,d);return!0};
|
|
|
|
d.onlyIfOutside&&(g=f+c.height(),n=l+c.width(),f<b&&b<g&&(b=f),l<m&&m<n&&(m=l));b!==f&&(k.scrollTop=b);m!==l&&(k.scrollLeft=m);c.prop("scrollHeight")===c.width()&&delete k.scrollTop;c.prop("scrollWidth")===c.width()&&delete k.scrollLeft;null!=k.scrollTop||null!=k.scrollLeft?c.animate(k,{duration:d.duration,easing:d.easing,complete:p}):p();return!0},fn:function(a){var d,b,c;d=[];var f=e(this);if(0===f.length)return this;a=e.extend({},h.config,a);b=f.parent();for(c=b.get(0);1===b.length&&c!==document.body&&
|
|
|
|
c!==document;){var g;g="visible"!==b.css("overflow-y")&&c.scrollHeight!==c.clientHeight;c="visible"!==b.css("overflow-x")&&c.scrollWidth!==c.clientWidth;if(g||c)d.push({$container:b,$target:f}),f=b;b=b.parent();c=b.get(0)}d.push({$container:e("html"),$target:f});"all"===a.durationMode&&(a.duration/=d.length);h.scroll(d,a);return this}};e.ScrollTo=e.ScrollTo||h;e.fn.ScrollTo=e.fn.ScrollTo||h.fn;return h}).call(this);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* zClip :: jQuery ZeroClipboard v1.1.1
|
|
|
|
* http://steamdev.com/zclip
|
|
|
|
*
|
|
|
|
* Copyright 2011, SteamDev
|
|
|
|
* Released under the MIT license.
|
|
|
|
* http://www.opensource.org/licenses/mit-license.php
|
|
|
|
*
|
|
|
|
* Date: Wed Jun 01, 2011
|
|
|
|
*/
|
|
|
|
|
|
|
|
(function(a){a.fn.zclip=function(c){if(typeof c=="object"&&!c.length){var b=a.extend({path:"ZeroClipboard.swf",copy:null,beforeCopy:null,afterCopy:null,clickAfter:true,setHandCursor:true,setCSSEffects:true},c);return this.each(function(){var e=a(this);if(e.is(":visible")&&(typeof b.copy=="string"||a.isFunction(b.copy))){ZeroClipboard.setMoviePath(b.path);var d=new ZeroClipboard.Client();if(a.isFunction(b.copy)){e.bind("zClip_copy",b.copy)}if(a.isFunction(b.beforeCopy)){e.bind("zClip_beforeCopy",b.beforeCopy)}if(a.isFunction(b.afterCopy)){e.bind("zClip_afterCopy",b.afterCopy)}d.setHandCursor(b.setHandCursor);d.setCSSEffects(b.setCSSEffects);d.addEventListener("mouseOver",function(f){e.trigger("mouseenter")});d.addEventListener("mouseOut",function(f){e.trigger("mouseleave")});d.addEventListener("mouseDown",function(f){e.trigger("mousedown");if(!a.isFunction(b.copy)){d.setText(b.copy)}else{d.setText(e.triggerHandler("zClip_copy"))}if(a.isFunction(b.beforeCopy)){e.trigger("zClip_beforeCopy")}});d.addEventListener("complete",function(f,g){if(a.isFunction(b.afterCopy)){e.trigger("zClip_afterCopy")}else{if(g.length>500){g=g.substr(0,500)+"...\n\n("+(g.length-500)+" characters not shown)"}e.removeClass("hover");alert("Copied text to clipboard:\n\n "+g)}if(b.clickAfter){e.trigger("click")}});d.glue(e[0],e.parent()[0]);a(window).bind("load resize",function(){d.reposition()})}})}else{if(typeof c=="string"){return this.each(function(){var f=a(this);c=c.toLowerCase();var e=f.data("zclipId");var d=a("#"+e+".zclip");if(c=="remove"){d.remove();f.removeClass("active hover")}else{if(c=="hide"){d.hide();f.removeClass("active hover")}else{if(c=="show"){d.show()}}}})}}}})(jQuery);var ZeroClipboard={version:"1.0.7",clients:{},moviePath:"ZeroClipboard.swf",nextId:1,$:function(a){if(typeof(a)=="string"){a=document.getElementById(a)}if(!a.addClass){a.hide=function(){/*this.style.display="none"*/};a.show=function(){this.style.display=""};a.addClass=function(b){this.removeClass(b);this.className+=" "+b};a.removeClass=function(d){var e=this.className.split(/\s+/);var b=-1;for(var c=0;c<e.length;c++){if(e[c]==d){b=c;c=e.length}}if(b>-1){e.splice(b,1);this.className=e.join(" ")}return this};a.hasClass=function(b){return !!this.className.match(new RegExp("\\s*"+b+"\\s*"))}}return a},setMoviePath:function(a){this.moviePath=a},dispatch:function(d,b,c){var a=this.clients[d];if(a){a.receiveEvent(b,c)}},register:function(b,a){this.clients[b]=a},getDOMObjectPosition:function(c,a){var b={left:0,top:0,width:c.width?c.width:c.offsetWidth,height:c.height?c.height:c.offsetHeight};if(c&&(c!=a)){b.left+=c.offsetLeft;b.top+=c.offsetTop}return b},Client:function(a){this.handlers={};this.id=ZeroClipboard.nextId++;this.movieId="ZeroClipboardMovie_"+this.id;ZeroClipboard.register(this.id,this);if(a){this.glue(a)}}};ZeroClipboard.Client.prototype={id:0,ready:false,movie:null,clipText:"",handCursorEnabled:true,cssEffects:true,handlers:null,glue:function(d,b,e){this.domElement=ZeroClipboard.$(d);var f=99;if(this.domElement.style.zIndex){f=parseInt(this.domElement.style.zIndex,10)+1}if(typeof(b)=="string"){b=ZeroClipboard.$(b)}else{if(typeof(b)=="undefined"){b=document.getElementsByTagName("body")[0]}}var c=ZeroClipboard.getDOMObjectPosition(this.domElement,b);this.div=document.createElement("div");this.div.className="zclip";this.div.id="zclip-"+this.movieId;$(this.domElement).data("zclipId","zclip-"+this.movieId);var a=this.div.style;a.position="absolute";a.left=""+c.left+"px";a.top=""+c.top+"px";a.width=""+c.width+"px";a.height=""+c.height+"px";a.zIndex=f;if(typeof(e)=="object"){for(addedStyle in e){a[addedStyle]=e[addedStyle]}}b.appendChild(this.div);this.div.innerHTML=this.getHTML(c.width,c.height)},getHTML:function(d,a){var c="";var b="id="+this.id+"&width="+d+"&height="+a;if(navigator.userAgent.match(/MSIE/)){var e=location.href.match(/^https/i)?"https://":"http://";c+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+e+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+d+'" height="'+a+'" id="'+this.movie
|