solo-third-skins/skins/Shawn/js/javascription.min.js
2019-03-16 19:01:27 +08:00

1 line
18 KiB
JavaScript

function emoticon(e){var t;if(e=" "+e+" ",!document.getElementById("comment")||"textarea"!=document.getElementById("comment").type)return!1;if(t=document.getElementById("comment"),document.selection)t.focus(),sel=document.selection.createRange(),sel.text=e,t.focus();else if(t.selectionStart||"0"==t.selectionStart){var n=t.selectionStart,o=t.selectionEnd,i=o;t.value=t.value.substring(0,n)+e+t.value.substring(o,t.value.length),i+=e.length,t.focus(),t.selectionStart=i,t.selectionEnd=i}else t.value+=e,t.focus()}function ctrlEnter(e){var t=e||window.event;t.ctrlKey&&13==t.keyCode&&(document.getElementById("submitCommentButtonReply")?document.getElementById("submitCommentButtonReply").click():document.getElementById("submitCommentButton").click())}!function($){function clickHandler(e){var t=this.form;if("image"==(t.clk=this).type)if(null!=e.offsetX)t.clk_x=e.offsetX,t.clk_y=e.offsetY;else if("function"==typeof $.fn.offset){var n=$(this).offset();t.clk_x=e.pageX-n.left,t.clk_y=e.pageY-n.top}else t.clk_x=e.pageX-this.offsetLeft,t.clk_y=e.pageY-this.offsetTop;setTimeout(function(){t.clk=t.clk_x=t.clk_y=null},10)}function submitHandler(){var e=this.formPluginId,t=$.fn.ajaxForm.optionHash[e];return $(this).ajaxSubmit(t),!1}$.fn.ajaxSubmit=function(o){"function"==typeof o&&(o={success:o}),o=$.extend({url:this.attr("action")||window.location.toString(),type:this.attr("method")||"GET"},o||{});var p={};if($.event.trigger("form.pre.serialize",[this,o,p]),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&&!1===o.beforeSubmit(a,this,o))return this;if($.event.trigger("form.submit.validate",[a,this,o,p]),p.veto)return this;var q=$.param(a);"GET"==o.type.toUpperCase()?(o.url+=(0<=o.url.indexOf("?")?"&":"?")+q,o.data=null):o.data=q;var r=this,callbacks=[];if(o.resetForm&&callbacks.push(function(){r.resetForm()}),o.clearForm&&callbacks.push(function(){r.clearForm()}),!o.dataType&&o.target){var u=o.success||function(){};callbacks.push(function(e){this.evalScripts?$(o.target).attr("innerHTML",e).evalScripts().each(u,arguments):$(o.target).html(e).each(u,arguments)})}else o.success&&callbacks.push(o.success);o.success=function(e,t){for(var n=0,o=callbacks.length;n<o;n++)callbacks[n](e,t,r)};for(var v=$("input:file",this).fieldValue(),w=!1,j=0;j<v.length;j++)v[j]&&(w=!0);return o.iframe||w?$.browser.safari&&o.closeKeepAlive?$.get(o.closeKeepAlive,fileUpload):fileUpload():$.ajax(o),$.event.trigger("form.submit.notify",[this,o]),this;function fileUpload(){var d=r[0],f=$.extend({},$.ajaxSettings,o),h="jqFormIO"+$.fn.ajaxSubmit.counter++,i=$('<iframe id="'+h+'" name="'+h+'" />'),j=i[0],k=$.browser.opera&&window.opera.version()<9;($.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(){}},g=f.global;g&&!$.active++&&$.event.trigger("ajaxStart"),g&&$.event.trigger("ajaxSend",[l,f]);var m=0,n=0;function cb(){if(!m++){j.detachEvent?j.detachEvent("onload",cb):j.removeEventListener("load",cb,!1);var a=!0;try{if(n)throw"timeout";var b,doc;if(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,"json"==f.dataType||"script"==f.dataType){var c=doc.getElementsByTagName("textarea")[0];b=c?c.value:l.responseText,"json"==f.dataType?eval("data = "+b):$.globalEval(b)}else"xml"==f.dataType?(b=l.responseXML,b||null==l.responseText||(b=toXml(l.responseText))):b=l.responseText}catch(e){a=!1,$.handleError(f,l,"error",e)}a&&(f.success(b,"success"),g&&$.event.trigger("ajaxSuccess",[l,f])),g&&$.event.trigger("ajaxComplete",[l,f]),g&&!--$.active&&$.event.trigger("ajaxStop"),f.complete&&f.complete(l,a?"success":"error"),setTimeout(function(){i.remove(),l.responseXML=null},100)}}function toXml(e,t){return window.ActiveXObject?((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.tagName?t:null}setTimeout(function(){var e=d.encoding?"encoding":"enctype",t=r.attr("target");r.attr({target:h,method:"POST",action:f.url}),d[e]="multipart/form-data",f.timeout&&setTimeout(function(){n=!0,cb()},f.timeout),i.appendTo("body"),j.attachEvent?j.attachEvent("onload",cb):j.addEventListener("load",cb,!1),d.submit(),r.attr("target",t)},10)}},$.fn.ajaxSubmit.counter=0,$.fn.ajaxForm=function(e){return this.ajaxFormUnbind().submit(submitHandler).each(function(){this.formPluginId=$.fn.ajaxForm.counter++,$.fn.ajaxForm.optionHash[this.formPluginId]=e,$(":submit,input:image",this).click(clickHandler)})},$.fn.ajaxForm.counter=1,$.fn.ajaxForm.optionHash={},$.fn.ajaxFormUnbind=function(){return this.unbind("submit",submitHandler),this.each(function(){$(":submit,input:image",this).unbind("click",clickHandler)})},$.fn.formToArray=function(e){var t=[];if(0==this.length)return t;var n=this[0],o=e?n.getElementsByTagName("*"):n.elements;if(!o)return t;for(var i=0,a=o.length;i<a;i++){var r=o[i];if(f=r.name)if(e&&n.clk&&"image"==r.type)r.disabled||n.clk!=r||t.push({name:f+".x",value:n.clk_x},{name:f+".y",value:n.clk_y});else{var s=$.fieldValue(r,!0);if(s&&s.constructor==Array)for(var c=0,l=s.length;c<l;c++)t.push({name:f,value:s[c]});else null!=s&&t.push({name:f,value:s})}}if(!e&&n.clk){var u=n.getElementsByTagName("input");for(i=0,a=u.length;i<a;i++){var f,d=u[i];(f=d.name)&&!d.disabled&&"image"==d.type&&n.clk==d&&t.push({name:f+".x",value:n.clk_x},{name:f+".y",value:n.clk_y})}}return t},$.fn.formSerialize=function(e){return $.param(this.formToArray(e))},$.fn.fieldSerialize=function(i){var a=[];return this.each(function(){var e=this.name;if(e){var t=$.fieldValue(this,i);if(t&&t.constructor==Array)for(var n=0,o=t.length;n<o;n++)a.push({name:e,value:t[n]});else null!=t&&a.push({name:this.name,value:t})}}),$.param(a)},$.fn.fieldValue=function(e){for(var t=[],n=0,o=this.length;n<o;n++){var i=this[n],a=$.fieldValue(i,e);null==a||a.constructor==Array&&!a.length||(a.constructor==Array?$.merge(t,a):t.push(a))}return t},$.fieldValue=function(e,t){var n=e.name,o=e.type,i=e.tagName.toLowerCase();if(void 0===t&&(t=!0),t&&(!n||e.disabled||"reset"==o||"button"==o||("checkbox"==o||"radio"==o)&&!e.checked||("submit"==o||"image"==o)&&e.form&&e.form.clk!=e||"select"==i&&-1==e.selectedIndex))return null;if("select"!=i)return e.value;var a=e.selectedIndex;if(a<0)return null;for(var r=[],s=e.options,c="select-one"==o,l=c?a+1:s.length,u=c?a:0;u<l;u++){var f=s[u];if(f.selected){var d=$.browser.msie&&!f.attributes.value.specified?f.text:f.value;if(c)return d;r.push(d)}}return r},$.fn.clearForm=function(){return this.each(function(){$("input,select,textarea",this).clearFields()})},$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var e=this.type,t=this.tagName.toLowerCase();"text"==e||"password"==e||"textarea"==t?this.value="":"checkbox"==e||"radio"==e?this.checked=!1:"select"==t&&(this.selectedIndex=-1)})},$.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},$.fn.enable=function(e){return null==e&&(e=!0),this.each(function(){this.disabled=!e})},$.fn.select=function(n){return null==n&&(n=!0),this.each(function(){var e=this.type;if("checkbox"==e||"radio"==e)this.checked=n;else if("option"==this.tagName.toLowerCase()){var t=$(this).parent("select");n&&t[0]&&"select-one"==t[0].type&&t.find("option").select(!1),this.selected=n}})}}(jQuery),$.fn.countdown=function(a){if(a||(a="()"),0==$(this).length)return!1;var b=this;return a.seconds<0||"undefined"==a.seconds?(a.callback&&eval(a.callback),null):(window.setTimeout(function(){$(b).html(String(a.seconds)),--a.seconds,$(b).countdown(a)},1e3),this)},$.fn.countdown.stop=function(){window.clearTimeout(setTimeout("0")-1)},function(i){var e=i.scrollTo=function(e,t,n){i(window).scrollTo(e,t,n)};function o(e){return"object"==typeof e?e:{top:e,left:e}}e.defaults={axis:"y",duration:1},e.window=function(e){return i(window).scrollable()},i.fn.scrollable=function(){return this.map(function(){var e=this.parentWindow||this.defaultView,t="#document"==this.nodeName?e.frameElement||e:this,n=t.contentDocument||(t.contentWindow||t).document,o=t.setInterval;return"IFRAME"==t.nodeName||o&&i.browser.safari?n.body:o?n.documentElement:this})},i.fn.scrollTo=function(t,n,v){return"object"==typeof n&&(v=n,n=0),"function"==typeof v&&(v={onAfter:v}),v=i.extend({},e.defaults,v),n=n||v.speed||v.duration,v.queue=v.queue&&1<v.axis.length,v.queue&&(n/=2),v.offset=o(v.offset),v.over=o(v.over),this.scrollable().each(function(){var u,f=this,d=i(f),p=t,h={},m=d.is("html,body");switch(typeof p){case"number":case"string":if(/^([+-]=)?\d+(px)?$/.test(p)){p=o(p);break}p=i(p,this);case"object":(p.is||p.style)&&(u=(p=i(p)).offset())}function g(e){d.animate(h,n,v.easing,e&&function(){e.call(this,t,v)})}i.each(v.axis.split(""),function(e,t){var n,o,i="x"==t?"Left":"Top",a=i.toLowerCase(),r="scroll"+i,s=f[r],c="x"==t?"Width":"Height",l=c.toLowerCase();u?(h[r]=u[a]+(m?0:s-d.offset()[a]),v.margin&&(h[r]-=parseInt(p.css("margin"+i))||0,h[r]-=parseInt(p.css("border"+i+"Width"))||0),h[r]+=v.offset[a]||0,v.over[a]&&(h[r]+=p[l]()*v.over[a])):h[r]=p[a],/^\d+$/.test(h[r])&&(h[r]=h[r]<=0?0:Math.min(h[r],(n="scroll"+c,o=f.ownerDocument,m?Math.max(o.documentElement[n],o.body[n]):f[n]))),!e&&v.queue&&(s!=h[r]&&g(v.onAfterFirst),delete h[r])}),g(v.onAfter)}).end()}}(jQuery),function(d){d.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}}}}),d.fn.extend({aflow:function(u){var f="string"==typeof(u=d.extend({},d.aflow.defaults,u)).toggleEffect?d.aflow.effects[u.toggleEffect]:u.toggleEffect;return this.hover(function(e){var t=d(this),n=t.parent(),o={width:t.outerWidth(),height:t.outerHeight()},i=t.offset(),a=n.offset(),r=d("div."+u.className,n).stop(),s=0==r.length;s&&(r=d("<div>&nbsp;</div>").addClass(u.className).appendTo(n).css(o));var c={left:i.left-a.left-(r.outerWidth()-r.width())/2,top:i.top-a.top-(r.outerHeight()-r.height())/2};if(s)r.css(c).css(f).animate(o,{queue:!1,duration:u.toggleSpeed,easing:u.easing});else{var l=d.extend({},o,c);r.animate(l,{queue:!1,duration:u.moveSpeed,easing:u.easing})}d.isFunction(u.hoverEffect)&&r.queue(u.hoverEffect)},function(e){d("div."+u.className).animate(f,{queue:!1,duration:u.toggleSpeed,easing:u.easing,complete:function(){d(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(){$("div.timeta,.rssfeed img,.twitter").hover(function(){$(this).fadeTo("fast","1")},function(){$(this).fadeTo("fast","0.7")}).fadeTo("normal","0.7");var e=$("#sidebar ul li ul li");$.browser.msie||e.hover(function(){$(this).fadeTo("fast","1")},function(){$(this).fadeTo("fast","0.7")}).fadeTo("normal","0.7"),(n=$("#footer .g2b,#footer .b2t")).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()},4e3)}),$("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 e=$(this).parent();setTimeout(function(){e.append("<span>shawnrx@gmail.com</span>"),$(".contact a").hide()},1e4)});var t=/^@/,n=/^#comment-/,o=$.browser.msie&&"6.0"==$.browser.version;$(".commentlist li .list p a").each(function(){$(this).text().match(t)&&$(this).attr("href").match(n)&&$(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(e){var t=$(".commentlist").offset();o?$(".backward").css({left:e.pageX-t.left-150,top:e.pageY-t.top+60}):$(".backward").css({left:e.pageX-t.left-60,top:e.pageY-t.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(){return window.open(this.href),!1}),$(".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(1e3)}),$(function(e){e.easing.elasout=function(e,t,n,o,i){var a=1.70158,r=0,s=o;if(0==t)return n;if(1==(t/=i))return n+o;if(r||(r=.3*i),s<Math.abs(o)){s=o;a=r/4}else a=r/(2*Math.PI)*Math.asin(o/s);return s*Math.pow(2,-10*t)*Math.sin((t*i-a)*(2*Math.PI)/r)+o+n},e("#footer .b2t").click(function(){return e.scrollTo("#header",800,{offset:-45}),!1}),e("#footer .g2b").click(function(){return e.scrollTo("#footer",1200),!1}),e(".say").click(function(){return e.scrollTo("#comments",500),!1}),e("img.atreply").click(function(){return e.scrollTo("#"+e(this).attr("data-id"),1e3,{easing:"elasout"}),!1});var t=window.location.hash.split("#")[1];t&&e.scrollTo("#"+t,1e3)}),$(function(e){e("#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>"),$.cookie=function(e,t,n){if(void 0===t){var o=null;if(document.cookie&&""!=document.cookie)for(var i=document.cookie.split(";"),a=0;a<i.length;a++){var r=$.trim(i[a]);if(r.substring(0,e.length+1)==e+"="){o=decodeURIComponent(r.substring(e.length+1));break}}return o}n=n||{},null===t&&(t="",n.expires=-1);var s,c="";n.expires&&("number"==typeof n.expires||n.expires.toUTCString)&&("number"==typeof n.expires?(s=new Date).setTime(s.getTime()+24*n.expires*60*60*1e3):s=n.expires,c="; expires="+s.toUTCString());var l=n.domain?"; domain="+n.domain:"",u=n.secure?"; secure":"";document.cookie=[e,"=",encodeURIComponent(t),c,";path=/",l,u].join("")},$(".advise a").click(function(){$(".advise").fadeOut(),$.cookie("subscrib","1",{expires:90})});var V=0;$.cookie("shawn_blog")&&(V=parseInt($.cookie("shawn_blog"))),$.cookie("shawn_blog",(V+1).toString(),{expires:90});var ie6=$.browser.msie&&"6.0"==$.browser.version;$("input#author:has[value]").length<=0&&5<V&&"1"!=$.cookie("subscrib")&&!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(x){x.browser.msie&&null==document.namespaces.v&&(document.namespaces.add("v","urn:schemas-microsoft-com:vml"),document.createStyleSheet().owningElement.styleSheet.cssText="v\\:*{behavior:url(#default#VML);}");x.fn.cornerz=function(e){function m(e,t,n,o,i){var a=x("<div style='display: inherit' />");return x.each(e.split(" "),function(){a.append(function(e,t,n,o,i,a){var r,s,c,l,u,f,d="position:absolute;";e?(r=-1.57,l=n,f=0,d+="top:-"+o+"px;"):(r=1.57,l=0,f=n,d+="bottom:-"+o+"px;"),t?(s=3.14,c=n,u=0,d+="left:-"+o+"px;"):(c=s=0,u=n,d+="right:-"+o+"px;");var p=x("<canvas width="+n+"px height="+n+"px style='"+d+"' ></canvas>"),h=p[0].getContext("2d");return h.beginPath(),h.lineWidth=2*o,h.arc(c,l,n,r,s,!(e^t)),h.strokeStyle=i,h.stroke(),h.lineWidth=0,h.lineTo(u,f),h.fillStyle=a,h.fill(),p}("t"==this[0],"l"==this[1],t,n,o,i))}),a}function g(e,t,n,o,i,a,r){return"<v:arc filled='False' strokeweight='"+t+"px' strokecolor='"+n+"' startangle='0' endangle='361' style=' top:"+(o-a)+"px;left: "+(o-i-r)+";width:"+e+"px; height:"+e+"px' />"}var v={corners:"tl tr bl br",radius:10,background:"white",borderWidth:0,fixIE:!0};x.extend(v,e||{});var b=function(e,t,n){var o=parseInt(e.css(t))||0;e.css(t,n+o)};return this.each(function(){var e=x(this),t=1*v.radius,n=1*(v.borderWidth||parseInt(e.css("borderTopWidth"))||0),o=v.background,i=v.borderColor;i=i||(0<n?e.css("borderTopColor"):o);var a,r,s,c,l,u,f=v.corners;if(x.browser.msie?(h=(a=f,r=t,s=n,c=i,l=o,x(this).width(),u="<div style='text-align:left; '>",x.each(x.trim(a).split(" "),function(){var e,t=1,n=1,o=0;"t"==this.charAt(0)?e="top:-"+s+"px;":(e="bottom:-"+s+"px;",n=r+1),"l"==this.charAt(1)?e+="left:-"+s+"px;":(e+="right:-"+s+"px; ",t=r,o=1),u+="<div style='"+e+"; position: absolute; overflow:hidden; width:"+r+"px; height: "+r+"px;'>",u+="<v:group style='width:1000px;height:1000px;position:absolute;' coordsize='1000,1000' >",u+=g(3*r,r+s,l,-r/2,t,n,o),0<s&&(u+=g(2*r-s,s,c,Math.floor(s/2+.5),t,n,o)),u+="</v:group>",u+="</div>"}),u+="</div>"),this.innerHTML+=h):e.append(m(f,t,n,i,o)),"absolute"!=this.style.position&&(this.style.position="relative"),this.style.zoom=1,x.browser.msie&&v.fixIE){var d=e.outerWidth(),p=e.outerHeight();d%2==1&&(b(e,"padding-right",1),b(e,"margin-right",1)),p%2==1&&(b(e,"padding-bottom",1),b(e,"margin-bottom",1))}})}}(jQuery),$.browser.mozilla||$(function(){$(".post #postail").cornerz({radius:7}),$(".nav li").cornerz({radius:8,background:"#EAEAEA",corners:"tl tr"})});