You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
18 KiB

4 years ago
(function(a){a.Typecho={insertFileToEditor:function(c,b,d){},editorResize:function(c,b){$("#"+c).resizeable({minHeight:100,afterResize:function(d){$.post(b,{size:d})}})},uploadComplete:function(b){}}})(window);(function(a){a.fn.dropdownMenu=function(b){this.each(function(){var d=this,c=a.extend({menuEl:null,btnEl:null},b);a(c.btnEl,d).click(function(){var e=a(this);e.toggleClass("active");a(c.menuEl,d).toggle();return false})})};a.fn.resizeable=function(b){var c=a.extend({minHeight:100,afterResize:null},b);return this.each(function(){var d=a('<span class="resize"><i></i></span>').insertAfter(this),j,g=0,e=c.minHeight,l=this;function f(m){textarea=a(m.data.el);textarea.blur();g=k(m).y;j=textarea.height()-g;textarea.css("opacity",0.25);a(document).mousemove(i).mouseup(h);return false}function i(o){var m=k(o).y,n=j+m;if(g>=(m)){n-=5}g=m;n=Math.max(e,n);textarea.height(n+"px");if(n<e){h(o)}return false}function h(n){var m=textarea.outerHeight();a(document).unbind("mousemove",i).unbind("mouseup",h);textarea.css("opacity",1);textarea.focus();textarea=null;j=null;g=0;if(c.afterResize){c.afterResize.call(l,m)}}function k(m){return{x:m.clientX+document.documentElement.scrollLeft,y:m.clientY+document.documentElement.scrollTop}}d.bind("mousedown",{el:this},f)})};a.fn.tableSelectable=function(c){var e=this,d=a.extend({checkEl:null,rowEl:null,selectAllEl:null,actionEl:null},c);function b(g){var g=a(g),f=a(d.checkEl,g),h=f.prop("checked");if(!f.length){return}f.prop("checked",!h);if(h){g.removeClass("checked")}else{g.addClass("checked")}}a(d.rowEl,this).each(function(){a(d.checkEl,this).click(function(f){b(a(this).parents(d.rowEl))})}).click(function(h){var g=a(h.toElement?h.toElement:h.target),f=g.prop("tagName").toLowerCase();if(a.inArray(f,["input","textarea","a","button","i"])>=0&&"checkbox"!=g.attr("type")){h.stopPropagation()}else{b(this)}});a(d.selectAllEl).click(function(){var f=a(this),g=f.prop("checked");if(g){a(d.rowEl,e).each(function(){var h=a(this),i=a(d.checkEl,this).prop("checked",true);if(i.length>0){h.addClass("checked")}})}else{a(d.rowEl,e).each(function(){var h=a(this),i=a(d.checkEl,this).prop("checked",false);if(i.length>0){h.removeClass("checked")}})}});a(d.actionEl).click(function(){var f=a(this),g=f.attr("lang");if(!g||confirm(g)){e.parents("form").attr("action",f.attr("href")).submit()}return false})}})($);(function(a){a.tableDnD={currentTable:null,dragObject:null,mouseOffset:null,oldY:0,build:function(b){b=b||{};this.each(function(){this.tableDnDConfig={onDragStyle:b.onDragStyle,onDropStyle:b.onDropStyle,onDragClass:b.onDragClass?b.onDragClass:"tDnD_whileDrag",onDrop:b.onDrop,onDragStart:b.onDragStart,scrollAmount:b.scrollAmount?b.scrollAmount:5};a.tableDnD.makeDraggable(this);if(0==$("tfoot",this).length&&0<$("thead",this).length){var d=$("thead",this),e=$("th",d).length,i=$('<tfoot><tr><td style="padding:0;height:0;line-height:0;border:none" colspan="'+e+'"></td></tr></tfoot>').insertAfter(d),c=$("tr:last",this);if(c.parent().prop("tagName").toLowerCase()!="tfoot"){var j=$("td",c),g=j.height();j.height(g-i.outerHeight())}}});a(document).bind("mousemove",a.tableDnD.mousemove).bind("mouseup",a.tableDnD.mouseup);return this},makeDraggable:function(e){var f=e.rows;var c=e.tableDnDConfig;for(var d=0;d<f.length;d++){var b=$(f[d]).hasClass("nodrag");if(!b){a(f[d]).mousedown(function(g){if(g.target.tagName=="TD"){a.tableDnD.dragObject=this;a.tableDnD.currentTable=e;a.tableDnD.mouseOffset=a.tableDnD.getMouseOffset(this,g);if(c.onDragStart){c.onDragStart(e,this)}return false}}).css("cursor","move")}}},mouseCoords:function(b){if(b.pageX||b.pageY){return{x:b.pageX,y:b.pageY}}return{x:b.clientX+document.body.scrollLeft-document.body.clientLeft,y:b.clientY+document.body.scrollTop-document.body.clientTop}},getMouseOffset:function(e,d){d=d||window.event;var c=this.getPosition(e);var b=this.mouseCoords(d);return{x:b.x-c.x,y:b.y-c.y}},getPosition:function(d){var c=0;var b=0;if(d.offsetHeight==0){d=d.firstChild}while(d.offsetParent){c+=d.offsetLeft;b+=d.offsetTop;d=d.offsetParent}c+=d.offsetLeft;b+=d.offsetTop;return{x:c,y:b
/*
* jQuery.ScrollTo
* Copyright (c) 2007-2012 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 4/09/2012
*
* @projectDescription Easy element scrolling using jQuery.
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
* @author Ariel Flesler
* @version 1.4.3.1
*
* @id jQuery.scrollTo
* @id jQuery.fn.scrollTo
* @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
* The different options for target are:
* - A number position (will be applied to all axes).
* - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
* - A jQuery/DOM element ( logically, child of the element to scroll )
* - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
* - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
* - A percentage of the container's dimension/s, for example: 50% to go to the middle.
* - The string 'max' for go-to-end.
* @param {Number, Function} duration The OVERALL length of the animation, this argument can be the settings object instead.
* @param {Object,Function} settings Optional set of settings or the onAfter callback.
* @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
* @option {Number, Function} duration The OVERALL length of the animation.
* @option {String} easing The easing method for the animation.
* @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
* @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
* @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
* @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
* @option {Function} onAfter Function to be called after the scrolling ends.
* @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
* @return {jQuery} Returns the same jQuery object, for chaining.
*
* @desc Scroll to a fixed position
* @example $('div').scrollTo( 340 );
*
* @desc Scroll relatively to the actual position
* @example $('div').scrollTo( '+=340px', { axis:'y' } );
*
* @desc Scroll using a selector (relative to the scrolled element)
* @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
*
* @desc Scroll to a DOM element (same for jQuery object)
* @example var second_child = document.getElementById('container').firstChild.nextSibling;
* $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
* alert('scrolled!!');
* }});
*
* @desc Scroll on both axes, to different values
* @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
*/
(function(c){var a=c.scrollTo=function(f,e,d){c(window).scrollTo(f,e,d)};a.defaults={axis:"xy",duration:parseFloat(c.fn.jquery)>=1.3?0:1,limit:true};a.window=function(d){return c(window)._scrollable()};c.fn._scrollable=function(){return this.map(function(){var e=this,d=!e.nodeName||c.inArray(e.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;if(!d){return e}var f=(e.contentWindow||e).document||e.ownerDocument||e;return/webkit/i.test(navigator.userAgent)||f.compatMode=="BackCompat"?f.body:f.documentElement})};c.fn.scrollTo=function(f,e,d){if(typeof e=="object"){d=e;e=0}if(typeof d=="function"){d={onAfter:d}}if(f=="max"){f=9000000000}d=c.extend({},a.defaults,d);e=e||d.duration;d.queue=d.queue&&d.axis.length>1;if(d.queue){e/=2}d.offset=b(d.offset);d.over=b(d.over);return this._scrollable().each(function(){if(f==null){return}var l=this,j=c(l),k=f,i,g={},m=j.is("html,body");switch(typeof k){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(k)){k=b(k);break}k=c(k,this);if(!k.length){return}case"object":if(k.is||k.style){i=(k=c(k)).offset()}}c.each(d.axis.split(""),function(q,r){var s=r=="x"?"Left":"Top",u=s.toLowerCase(),p="scroll"+s,o=l[p],n=a.max(l,r);if(i){g[p]=i[u]+(m?0:o-j.offset()[u]);if(d.margin){g[p]-=parseInt(k.css("margin"+s))||0;g[p]-=parseInt(k.css("border"+s+"Width"))||0}g[p]+=d.offset[u]||0;if(d.over[u]){g[p]+=k[r=="x"?"width":"height"]()*d.over[u]}}else{var t=k[u];g[p]=t.slice&&t.slice(-1)=="%"?parseFloat(t)/100*n:t}if(d.limit&&/^\d+$/.test(g[p])){g[p]=g[p]<=0?0:Math.min(g[p],n)}if(!q&&d.queue){if(o!=g[p]){h(d.onAfterFirst)}delete g[p]}});h(d.onAfter);function h(n){j.animate(g,e,d.easing,n&&function(){n.call(this,f,d)})}}).end()};a.max=function(j,i){var h=i=="x"?"Width":"Height",e="scroll"+h;if(!c(j).is("html,body")){return j[e]-c(j)[h.toLowerCase()]()}var g="client"+h,f=j.ownerDocument.documentElement,d=j.ownerDocument.body;return Math.max(f[e],d[e])-Math.min(f[g],d[g])};function b(d){return typeof d=="object"?d:{top:d,left:d}}})(jQuery);jQuery.fn.css2=jQuery.fn.css;jQuery.fn.css=function(){if(arguments.length){return jQuery.fn.css2.apply(this,arguments)}var b=["font-family","font-size","font-weight","font-style","color","box-sizing","text-transform","text-decoration","letter-spacing","box-shadow","line-height","text-align","vertical-align","direction","background-color","background-image","background-repeat","background-position","background-attachment","opacity","width","height","top","right","bottom","left","margin-top","margin-right","margin-bottom","margin-left","padding-top","padding-right","padding-bottom","padding-left","border-top-width","border-right-width","border-bottom-width","border-left-width","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style","position","display","visibility","z-index","overflow-x","overflow-y","white-space","clip","float","clear","cursor","list-style-image","list-style-position","list-style-type","marker-offset"];var a=b.length,d={};for(var c=0;c<a;c++){d[b[c]]=jQuery.fn.css2.call(this,b[c])}return d};