solo-third-skins/Shawn/js/javascription.min.js
Ansen c0253332b0 add skins
add skins
2012-12-26 17:46:04 +08:00

1 line
19 KiB
JavaScript

(function($){$.fn.ajaxSubmit=function(o){if(typeof o=="function"){o={success:o}}o=$.extend({url:this.attr("action")||window.location.toString(),type:this.attr("method")||"GET"},o||{});var p={};$.event.trigger("form.pre.serialize",[this,o,p]);if(p.veto){return this}var a=this.formToArray(o.semantic);if(o.data){for(var n in o.data){a.push({name:n,value:o.data[n]})}}if(o.beforeSubmit&&o.beforeSubmit(a,this,o)===false){return this}$.event.trigger("form.submit.validate",[a,this,o,p]);if(p.veto){return this}var q=$.param(a);if(o.type.toUpperCase()=="GET"){o.url+=(o.url.indexOf("?")>=0?"&":"?")+q;o.data=null}else{o.data=q}var r=this,callbacks=[];if(o.resetForm){callbacks.push(function(){r.resetForm()})}if(o.clearForm){callbacks.push(function(){r.clearForm()})}if(!o.dataType&&o.target){var u=o.success||function(){};callbacks.push(function(a){if(this.evalScripts){$(o.target).attr("innerHTML",a).evalScripts().each(u,arguments)}else{$(o.target).html(a).each(u,arguments)}})}else{if(o.success){callbacks.push(o.success)}}o.success=function(a,b){for(var i=0,max=callbacks.length;i<max;i++){callbacks[i](a,b,r)}};var v=$("input:file",this).fieldValue();var w=false;for(var j=0;j<v.length;j++){if(v[j]){w=true}}if(o.iframe||w){if($.browser.safari&&o.closeKeepAlive){$.get(o.closeKeepAlive,fileUpload)}else{fileUpload()}}else{$.ajax(o)}$.event.trigger("form.submit.notify",[this,o]);return this;function fileUpload(){var d=r[0];var f=$.extend({},$.ajaxSettings,o);var h="jqFormIO"+$.fn.ajaxSubmit.counter++;var i=$('<iframe id="'+h+'" name="'+h+'" />');var j=i[0];var k=$.browser.opera&&window.opera.version()<9;if($.browser.msie||k){j.src='javascript:false;document.write("");'}i.css({position:"absolute",top:"-1000px",left:"-1000px"});var l={responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){}};var g=f.global;if(g&&!$.active++){$.event.trigger("ajaxStart")}if(g){$.event.trigger("ajaxSend",[l,f])}var m=0;var n=0;setTimeout(function(){var a=d.encoding?"encoding":"enctype";var t=r.attr("target");r.attr({target:h,method:"POST",action:f.url});d[a]="multipart/form-data";if(f.timeout){setTimeout(function(){n=true;cb()},f.timeout)}i.appendTo("body");j.attachEvent?j.attachEvent("onload",cb):j.addEventListener("load",cb,false);d.submit();r.attr("target",t)},10);function cb(){if(m++){return}j.detachEvent?j.detachEvent("onload",cb):j.removeEventListener("load",cb,false);var a=true;try{if(n){throw"timeout"}var b,doc;doc=j.contentWindow?j.contentWindow.document:j.contentDocument?j.contentDocument:j.document;l.responseText=doc.body?doc.body.innerHTML:null;l.responseXML=doc.XMLDocument?doc.XMLDocument:doc;if(f.dataType=="json"||f.dataType=="script"){var c=doc.getElementsByTagName("textarea")[0];b=c?c.value:l.responseText;if(f.dataType=="json"){eval("data = "+b)}else{$.globalEval(b)}}else{if(f.dataType=="xml"){b=l.responseXML;if(!b&&l.responseText!=null){b=toXml(l.responseText)}}else{b=l.responseText}}}catch(e){a=false;$.handleError(f,l,"error",e)}if(a){f.success(b,"success");if(g){$.event.trigger("ajaxSuccess",[l,f])}}if(g){$.event.trigger("ajaxComplete",[l,f])}if(g&&!--$.active){$.event.trigger("ajaxStop")}if(f.complete){f.complete(l,a?"success":"error")}setTimeout(function(){i.remove();l.responseXML=null},100)}function toXml(s,a){if(window.ActiveXObject){a=new ActiveXObject("Microsoft.XMLDOM");a.async="false";a.loadXML(s)}else{a=(new DOMParser()).parseFromString(s,"text/xml")}return(a&&a.documentElement&&a.documentElement.tagName!="parsererror")?a:null}}};$.fn.ajaxSubmit.counter=0;$.fn.ajaxForm=function(a){return this.ajaxFormUnbind().submit(submitHandler).each(function(){this.formPluginId=$.fn.ajaxForm.counter++;$.fn.ajaxForm.optionHash[this.formPluginId]=a;$(":submit,input:image",this).click(clickHandler)})};$.fn.ajaxForm.counter=1;$.fn.ajaxForm.optionHash={};function clickHandler(e){var a=this.form;a.clk=this;if(this.type=="image"){if(e.offsetX!=undefined){a.clk_x=e.offsetX;a.clk_y=e.offsetY}else{if(typeof $.fn.offset=="function"){var b=$(this).offset();a.clk_x=e.pageX-b.left;a.clk_y=e.pageY-b.top}else{a.clk_x=e.pageX-this.offsetLeft;a.clk_y=e.pageY-this.offsetTop}}}setTimeout(function(){a.clk=a.clk_x=a.clk_y=null},10)}function submitHandler(){var a=this.formPluginId;var b=$.fn.ajaxForm.optionHash[a];$(this).ajaxSubmit(b);return false}$.fn.ajaxFormUnbind=function(){this.unbind("submit",submitHandler);return this.each(function(){$(":submit,input:image",this).unbind("click",clickHandler)})};$.fn.formToArray=function(b){var a=[];if(this.length==0){return a}var c=this[0];var d=b?c.getElementsByTagName("*"):c.elements;if(!d){return a}for(var i=0,max=d.length;i<max;i++){var e=d[i];var n=e.name;if(!n){continue}if(b&&c.clk&&e.type=="image"){if(!e.disabled&&c.clk==e){a.push({name:n+".x",value:c.clk_x},{name:n+".y",value:c.clk_y})}continue}var v=$.fieldValue(e,true);if(v&&v.constructor==Array){for(var j=0,jmax=v.length;j<jmax;j++){a.push({name:n,value:v[j]})}}else{if(v!==null&&typeof v!="undefined"){a.push({name:n,value:v})}}}if(!b&&c.clk){var f=c.getElementsByTagName("input");for(var i=0,max=f.length;i<max;i++){var g=f[i];var n=g.name;if(n&&!g.disabled&&g.type=="image"&&c.clk==g){a.push({name:n+".x",value:c.clk_x},{name:n+".y",value:c.clk_y})}}}return a};$.fn.formSerialize=function(a){return $.param(this.formToArray(a))};$.fn.fieldSerialize=function(b){var a=[];this.each(function(){var n=this.name;if(!n){return}var v=$.fieldValue(this,b);if(v&&v.constructor==Array){for(var i=0,max=v.length;i<max;i++){a.push({name:n,value:v[i]})}}else{if(v!==null&&typeof v!="undefined"){a.push({name:this.name,value:v})}}});return $.param(a)};$.fn.fieldValue=function(a){for(var b=[],i=0,max=this.length;i<max;i++){var c=this[i];var v=$.fieldValue(c,a);if(v===null||typeof v=="undefined"||(v.constructor==Array&&!v.length)){continue}v.constructor==Array?$.merge(b,v):b.push(v)}return b};$.fieldValue=function(b,c){var n=b.name,t=b.type,tag=b.tagName.toLowerCase();if(typeof c=="undefined"){c=true}if(c&&(!n||b.disabled||t=="reset"||t=="button"||(t=="checkbox"||t=="radio")&&!b.checked||(t=="submit"||t=="image")&&b.form&&b.form.clk!=b||tag=="select"&&b.selectedIndex==-1)){return null}if(tag=="select"){var d=b.selectedIndex;if(d<0){return null}var a=[],ops=b.options;var e=(t=="select-one");var f=(e?d+1:ops.length);for(var i=(e?d:0);i<f;i++){var g=ops[i];if(g.selected){var v=$.browser.msie&&!(g.attributes.value.specified)?g.text:g.value;if(e){return v}a.push(v)}}return a}return b.value};$.fn.clearForm=function(){return this.each(function(){$("input,select,textarea",this).clearFields()})};$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();if(t=="text"||t=="password"||tag=="textarea"){this.value=""}else{if(t=="checkbox"||t=="radio"){this.checked=false}else{if(tag=="select"){this.selectedIndex=-1}}}})};$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};$.fn.enable=function(b){if(b==undefined){b=true}return this.each(function(){this.disabled=!b})};$.fn.select=function(b){if(b==undefined){b=true}return this.each(function(){var t=this.type;if(t=="checkbox"||t=="radio"){this.checked=b}else{if(this.tagName.toLowerCase()=="option"){var a=$(this).parent("select");if(b&&a[0]&&a[0].type=="select-one"){a.find("option").select(false)}this.selected=b}}})}})(jQuery);$.fn.countdown=function(a){if(!a){a="()"}if($(this).length==0){return false}var b=this;if(a.seconds<0||a.seconds=="undefined"){if(a.callback){eval(a.callback)}return null}window.setTimeout(function(){$(b).html(String(a.seconds));--a.seconds;$(b).countdown(a)},1000);return this};$.fn.countdown.stop=function(){window.clearTimeout(setTimeout("0")-1)};(function(c){var b=c.scrollTo=function(f,d,e){c(window).scrollTo(f,d,e)};b.defaults={axis:"y",duration:1};b.window=function(d){return c(window).scrollable()};c.fn.scrollable=function(){return this.map(function(){var d=this.parentWindow||this.defaultView,f=this.nodeName=="#document"?d.frameElement||d:this,e=f.contentDocument||(f.contentWindow||f).document,g=f.setInterval;return f.nodeName=="IFRAME"||g&&c.browser.safari?e.body:g?e.documentElement:this})};c.fn.scrollTo=function(f,d,e){if(typeof d=="object"){e=d;d=0}if(typeof e=="function"){e={onAfter:e}}e=c.extend({},b.defaults,e);d=d||e.speed||e.duration;e.queue=e.queue&&e.axis.length>1;if(e.queue){d/=2}e.offset=a(e.offset);e.over=a(e.over);return this.scrollable().each(function(){var o=this,i=c(o),g=f,j,l={},n=i.is("html,body");switch(typeof g){case"number":case"string":if(/^([+-]=)?\d+(px)?$/.test(g)){g=a(g);break}g=c(g,this);case"object":if(g.is||g.style){j=(g=c(g)).offset()}}c.each(e.axis.split(""),function(t,s){var r=s=="x"?"Left":"Top",p=r.toLowerCase(),u="scroll"+r,w=o[u],v=s=="x"?"Width":"Height",q=v.toLowerCase();if(j){l[u]=j[p]+(n?0:w-i.offset()[p]);if(e.margin){l[u]-=parseInt(g.css("margin"+r))||0;l[u]-=parseInt(g.css("border"+r+"Width"))||0}l[u]+=e.offset[p]||0;if(e.over[p]){l[u]+=g[q]()*e.over[p]}}else{l[u]=g[p]}if(/^\d+$/.test(l[u])){l[u]=l[u]<=0?0:Math.min(l[u],m(v))}if(!t&&e.queue){if(w!=l[u]){k(e.onAfterFirst)}delete l[u]}});k(e.onAfter);function k(p){i.animate(l,d,e.easing,p&&function(){p.call(this,f,e)})}function m(q){var r="scroll"+q,p=o.ownerDocument;return n?Math.max(p.documentElement[r],p.body[r]):o[r]}}).end()};function a(d){return typeof d=="object"?d:{top:d,left:d}}})(jQuery);(function(a){a.extend({aflow:{version:1,defaults:{toggleSpeed:75,toggleEffect:"both",hoverEffect:null,moveSpeed:250,easing:"swing",className:"aflow"},effects:{width:{width:0},height:{height:0},both:{width:0,height:0}}}});a.fn.extend({aflow:function(b){var b=a.extend({},a.aflow.defaults,b);var c=((typeof b.toggleEffect=="string")?a.aflow.effects[b.toggleEffect]:b.toggleEffect);return this.hover(function(k){var j=a(this);var d=j.parent();var l={width:j.outerWidth(),height:j.outerHeight()};var f=j.offset();var e=d.offset();var i=a("div."+b.className,d).stop();var m=(i.length==0);if(m){i=a("<div>&nbsp;</div>").addClass(b.className).appendTo(d).css(l)}var n={left:f.left-e.left-(i.outerWidth()-i.width())/2,top:f.top-e.top-(i.outerHeight()-i.height())/2};if(m){i.css(n).css(c).animate(l,{queue:false,duration:b.toggleSpeed,easing:b.easing})}else{var g=a.extend({},l,n);i.animate(g,{queue:false,duration:b.moveSpeed,easing:b.easing})}if(a.isFunction(b.hoverEffect)){i.queue(b.hoverEffect)}},function(d){a("div."+b.className).animate(c,{queue:false,duration:b.toggleSpeed,easing:b.easing,complete:function(){a(this).remove()}})})}})})(jQuery);$(".post #postail,.reply #submit").css({"-moz-border-radius":"7px","-webkit-border-radius":"7px","border-radius":"7px"});$(".nav li").css({"-moz-border-radius-topright":"8px","-moz-border-radius-topleft":"8px"});$(".entry p.code").css("word-break","break-all");$(document).ready(function(){var a=$("div.timeta,.rssfeed img,.twitter");a.hover(function(){$(this).fadeTo("fast","1")},function(){$(this).fadeTo("fast","0.7")}).fadeTo("normal","0.7");var d=$("#sidebar ul li ul li");if(!$.browser.msie){d.hover(function(){$(this).fadeTo("fast","1")},function(){$(this).fadeTo("fast","0.7")}).fadeTo("normal","0.7")}var b=$("#footer .g2b,#footer .b2t");b.hover(function(){$(this).fadeTo("fast","1")},function(){$(this).fadeTo("fast","0.2")}).fadeTo("normal","0.2");$("a[rel!='nofollow']a[rel!='external'][target!='_blank']a[class!='nopopup']").click(function(){$("#loading").slideDown();setTimeout(function(){$("#loading").fadeOut()},4000)});$("a[href*='#'],a[rel='external nofollow'],a[href='javascript:void(0)'],a[href='javascript:reset_captcha('')']").click(function(){$("#loading").fadeOut("slow")});$(".post .entry p a:has(img)").css({background:"transparent",border:"none"});$(".post .entry p:has(img[src*='yupoo'])").css({"text-indent":"0px","text-align":"center"});$(".post .entry p:has(object)").css({"text-indent":"0px","text-align":"center",height:"344px",background:"url(/skins/Shawn/images/videobg.png) no-repeat center center",padding:"15px 0 19px"});$("#sidebar ul:nth-child(even)").css("background","url(/skins/Shawn/images/sidelines.gif) no-repeat");$("#sidebar ul li ul").css("background","none");$(".contact a").click(function(){$(this).countdown({seconds:9}).css({border:"none","font-size":"16px",color:"red"}).unbind("click");var i="shawnrx";var g="gmail.com";var f=$(this).parent();setTimeout(function(){f.append("<span>"+i+"@"+g+"</span>");$(".contact a").hide()},10000)});var e=/^@/;var b=/^#comment-/;var c=$.browser.msie&&$.browser.version=="6.0";$(".commentlist li .list p a").each(function(){if($(this).text().match(e)&&$(this).attr("href").match(b)){$(this).addClass("replybox").removeAttr("rel","nofollow")}});$(".replybox").hover(function(){$($(this).attr("href")).clone().hide().attr("id","").insertAfter($(this).parents("li")).addClass("backward").css({display:"block",opacity:"0"}).animate({marginTop:"-50px",opacity:"1"},500)},function(){$(".backward").animate({marginTop:"40px",opacity:"0"},500).hide(100,function(){$(this).remove()})}).mousemove(function(f){var g=$(".commentlist").offset();if(c){$(".backward").css({left:(f.pageX-g.left-150),top:(f.pageY-g.top+60)})}else{$(".backward").css({left:(f.pageX-g.left-60),top:(f.pageY-g.top+60),"-moz-border-radius":"10px","-webkit-border-radius":"10px"})}});$(".reply input,.reply textarea").focus(function(){$(this).next("span").fadeIn("fast")}),$(".reply input,.reply textarea").blur(function(){$(this).next("span").fadeOut("fast")});$("a[rel='nofollow'],a[rel='external'],a[rel='external nofollow']").click(function(){window.open(this.href);return false});$(".commentlist li").hover(function(){$(this).find(".atreply").css("display","block")},function(){$(this).find(".atreply").css("display","none")});$.getScript("http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en-us");$("#share").hover(function(){$("#share ul").css("display","block").animate({top:"-205px",opacity:"0.8"},500)},function(){$("#share ul").animate({top:"-225px",opacity:"0.1"},300);setTimeout(function(){$("#share ul").css("display","none")},310)});$("#loading").fadeOut(1000)});$(function(b){b.easing.elasout=function(g,i,j,c,d){var e=1.70158;var f=0;var k=c;if(i==0){return j}if((i/=d)==1){return j+c}if(!f){f=d*0.3}if(k<Math.abs(c)){k=c;var e=f/4}else{var e=f/(2*Math.PI)*Math.asin(c/k)}return k*Math.pow(2,-10*i)*Math.sin((i*d-e)*(2*Math.PI)/f)+c+j};b("#footer .b2t").click(function(){b.scrollTo("#header",800,{offset:-45});return false});b("#footer .g2b").click(function(){b.scrollTo("#footer",1200);return false});b(".say").click(function(){b.scrollTo("#comments",500);return false});b("img.atreply").click(function(){b.scrollTo("#"+b(this).attr("data-id"),1000,{easing:"elasout"});return false});var a=window.location.hash.split("#")[1];if(a){b.scrollTo("#"+a,1000)}});$(function(a){a("#sidebar ul li ul li").aflow({toggleEffect:"height",moveSpeed:75,toggleSpeed:250})});document.writeln("<style type='text/css'>.aflow{-moz-border-radius:7px;-webkit-border-radius:7px;border-radius:7px}.post .index p a:hover{text-decoration:underline}</style>");function emoticon(e){var c;e=" "+e+" ";if(document.getElementById("comment")&&document.getElementById("comment").type=="textarea"){c=document.getElementById("comment")}else{return false}if(document.selection){c.focus();sel=document.selection.createRange();sel.text=e;c.focus()}else{if(c.selectionStart||c.selectionStart=="0"){var b=c.selectionStart;var a=c.selectionEnd;var d=a;c.value=c.value.substring(0,b)+e+c.value.substring(a,c.value.length);d+=e.length;c.focus();c.selectionStart=d;c.selectionEnd=d}else{c.value+=e;c.focus()}}}function ctrlEnter(a){var b=a?a:window.event;if(b.ctrlKey&&b.keyCode==13){if(document.getElementById("submitCommentButtonReply")){document.getElementById("submitCommentButtonReply").click()}else{document.getElementById("submitCommentButton").click()}}}$.cookie=function(k,e,i){if(typeof e!="undefined"){i=i||{};if(e===null){e="";i.expires=-1}var a="";if(i.expires&&(typeof i.expires=="number"||i.expires.toUTCString)){var b;if(typeof i.expires=="number"){b=new Date();b.setTime(b.getTime()+(i.expires*24*60*60*1000))}else{b=i.expires}a="; expires="+b.toUTCString()}var g=";path=/";var c=i.domain?"; domain="+(i.domain):"";var j=i.secure?"; secure":"";document.cookie=[k,"=",encodeURIComponent(e),a,g,c,j].join("")}else{var m=null;if(document.cookie&&document.cookie!=""){var f=document.cookie.split(";");for(var d=0;d<f.length;d++){var l=$.trim(f[d]);if(l.substring(0,k.length+1)==(k+"=")){m=decodeURIComponent(l.substring(k.length+1));break}}}return m}};$(".advise a").click(function(){$(".advise").fadeOut();$.cookie("subscrib","1",{expires:90})});var V=0;if($.cookie("shawn_blog")){V=parseInt($.cookie("shawn_blog"))}$.cookie("shawn_blog",(V+1).toString(),{expires:90});var ie6=$.browser.msie&&$.browser.version=="6.0";if($("input#author:has[value]").length<=0&&V>5&&$.cookie("subscrib")!="1"&&!ie6){$(".advise").fadeIn(1500)}var FC="<span style='background:#fff;position:absolute;margin-left:-220px;padding:5px;width:220px;height:20px'></span>";$(".linklove").append(FC);(function(a){if(a.browser.msie&&document.namespaces.v==null){document.namespaces.add("v","urn:schemas-microsoft-com:vml");var b=document.createStyleSheet().owningElement;b.styleSheet.cssText="v\\:*{behavior:url(#default#VML);}"}a.fn.cornerz=function(d){function j(D,q,n,y,u,s){var B,v,r,A,x,z,w,o=1.57,t="position:absolute;";if(D){B=-o;x=n;w=0;t+="top:-"+y+"px;"}else{B=o;x=0;w=n;t+="bottom:-"+y+"px;"}if(q){v=o*2;A=n;z=0;t+="left:-"+y+"px;"}else{v=0;A=0;z=n;t+="right:-"+y+"px;"}var p=a("<canvas width="+n+"px height="+n+"px style='"+t+"' ></canvas>");var C=p[0].getContext("2d");C.beginPath();C.lineWidth=y*2;C.arc(A,x,n,B,v,!(D^q));C.strokeStyle=u;C.stroke();C.lineWidth=0;C.lineTo(z,w);C.fillStyle=s;C.fill();return p}function c(m,p,l,k,o){var n=a("<div style='display: inherit' />");a.each(m.split(" "),function(){n.append(j(this[0]=="t",this[1]=="l",p,l,k,o))});return n}function f(k,q,p,m,o,l,r){var n=m-o-r;var s=m-l;return"<v:arc filled='False' strokeweight='"+q+"px' strokecolor='"+p+"' startangle='0' endangle='361' style=' top:"+s+"px;left: "+n+";width:"+k+"px; height:"+k+"px' />"}function i(p,o,l,k,q,n){var m="<div style='text-align:left; '>";a.each(a.trim(p).split(" "),function(){var s,u=1,r=1,t=0;if(this.charAt(0)=="t"){s="top:-"+l+"px;"}else{s="bottom:-"+l+"px;";r=o+1}if(this.charAt(1)=="l"){s+="left:-"+l+"px;"}else{s+="right:-"+(l)+"px; ";u=o;t=1}m+="<div style='"+s+"; position: absolute; overflow:hidden; width:"+o+"px; height: "+o+"px;'>";m+="<v:group style='width:1000px;height:1000px;position:absolute;' coordsize='1000,1000' >";m+=f(o*3,o+l,q,-o/2,u,r,t);if(l>0){m+=f(o*2-l,l,k,Math.floor(l/2+0.5),u,r,t)}m+="</v:group>";m+="</div>"});m+="</div>";return m}var e={corners:"tl tr bl br",radius:10,background:"white",borderWidth:0,fixIE:true};a.extend(e,d||{});var g=function(m,k,l){var n=parseInt(m.css(k))||0;m.css(k,l+n)};return this.each(function(){var p=a(this);var n=e.radius*1;var m=(e.borderWidth||parseInt(p.css("borderTopWidth"))||0)*1;var r=e.background;var l=e.borderColor;l=l||(m>0?p.css("borderTopColor"):r);var k=e.corners;if(a.browser.msie){h=i(k,n,m,l,r,a(this).width());this.innerHTML+=h}else{p.append(c(k,n,m,l,r))}if(this.style.position!="absolute"){this.style.position="relative"}this.style.zoom=1;if(a.browser.msie&&e.fixIE){var q=p.outerWidth();var o=p.outerHeight();if(q%2==1){g(p,"padding-right",1);g(p,"margin-right",1)}if(o%2==1){g(p,"padding-bottom",1);g(p,"margin-bottom",1)}}})}})(jQuery);if(!$.browser.mozilla){$(function(){$(".post #postail").cornerz({radius:7});$(".nav li").cornerz({radius:8,background:"#EAEAEA",corners:"tl tr"})})};