Kode Kesayangan

$(document.body).on("dblclick", "code,#comments pre", function () {
    var c = $(window).width(),
        e = $(window).height(),
        d = $(this).html().replace(/<(.*?)>/g, ""),
        f = window.open("", "", "width=400,height=250,top=" + ((e / 2) - 125) + ",left=" + ((c / 2) - 200) + ",scrollbars=0");
    f.document.write('<!DOCTYPE html><html><head><title>Source Code</title><style type="text/css">*{margin:0;padding:0}textarea{display:block;position:absolute;top:0;right:0;bottom:0;left:0;resize:none;border:none;width:100%;height:100%;background-color:white;color:black}</style></head><body><textarea>' + d + "</textarea></body><script type=\"text/javascript\">var a=document.getElementsByTagName('textarea')[0];a.focus();a.select();<\/script></html>")
});
});

function ssc_init(){if(!document.body){return}var i=document.body;var e=document.documentElement;var h=window.innerHeight;var j=i.scrollHeight;ssc_root=document.compatMode.indexOf("CSS")>=0?e:i;ssc_activeElement=i;ssc_initdone=true;if(top!=self){ssc_frame=true}else{if(j>h&&(i.offsetHeight<=h||e.offsetHeight<=h)){ssc_root.style.height="auto";if(ssc_root.offsetHeight<=h){var g=document.createElement("div");g.style.clear="both";i.appendChild(g)}}}if(!ssc_fixedback){i.style.backgroundAttachment="scroll";e.style.backgroundAttachment="scroll"}if(ssc_keyboardsupport){ssc_addEvent("keydown",ssc_keydown)}}function ssc_scrollArray(i,e,h,j){j||(j=1000);ssc_directionCheck(e,h);ssc_que.push({x:e,y:h,lastX:e<0?0.99:-0.99,lastY:h<0?0.99:-0.99,start:+(new Date)});if(ssc_pending){return}var g=function(){var p=+(new Date);var m=0;var s=0;for(var v=0;v<ssc_que.length;v++){var c=ssc_que[v];var f=p-c.start;var a=f>=ssc_animtime;var d=a?1:f/ssc_animtime;if(ssc_pulseAlgorithm){d=ssc_pulse(d)}var o=c.x*d-c.lastX>>0;var b=c.y*d-c.lastY>>0;m+=o;s+=b;c.lastX+=o;c.lastY+=b;if(a){ssc_que.splice(v,1);v--}}if(e){var u=i.scrollLeft;i.scrollLeft+=m;if(m&&i.scrollLeft===u){e=0}}if(h){var l=i.scrollTop;i.scrollTop+=s;if(s&&i.scrollTop===l){h=0}}if(!e&&!h){ssc_que=[]}if(ssc_que.length){setTimeout(g,j/ssc_framerate+1)}else{ssc_pending=false}};setTimeout(g,0);ssc_pending=true}function ssc_wheel(i){if(!ssc_initdone){ssc_init()}var e=i.target;var h=ssc_overflowingAncestor(e);if(!h||i.defaultPrevented||ssc_isNodeName(ssc_activeElement,"embed")||ssc_isNodeName(e,"embed")&&/\.pdf/i.test(e.src)){return true}var j=i.wheelDeltaX||0;var g=i.wheelDeltaY||0;if(!j&&!g){g=i.wheelDelta||0}if(Math.abs(j)>1.2){j*=ssc_stepsize/120}if(Math.abs(g)>1.2){g*=ssc_stepsize/120}ssc_scrollArray(h,-j,-g);i.preventDefault()}function ssc_keydown(n){var e=n.target;var p=n.ctrlKey||n.altKey||n.metaKey;if(/input|textarea|embed/i.test(e.nodeName)||e.isContentEditable||n.defaultPrevented||p){return true}if(ssc_isNodeName(e,"button")&&n.keyCode===ssc_key.spacebar){return true}var r,o=0,a=0;var q=ssc_overflowingAncestor(ssc_activeElement);var i=q.clientHeight;if(q==document.body){i=window.innerHeight}switch(n.keyCode){case ssc_key.up:a=-ssc_arrowscroll;break;case ssc_key.down:a=ssc_arrowscroll;break;case ssc_key.spacebar:r=n.shiftKey?1:-1;a=-r*i*0.9;break;case ssc_key.pageup:a=-i*0.9;break;case ssc_key.pagedown:a=i*0.9;break;case ssc_key.home:a=-q.scrollTop;break;case ssc_key.end:var m=q.scrollHeight-q.scrollTop-i;a=m>0?m+10:0;break;case ssc_key.left:o=-ssc_arrowscroll;break;case ssc_key.right:o=ssc_arrowscroll;break;default:return true}ssc_scrollArray(q,o,a);n.preventDefault()}function ssc_mousedown(b){ssc_activeElement=b.target}function ssc_setCache(d,e){for(var f=d.length;f--;){ssc_cache[ssc_uniqueID(d[f])]=e}return e}function ssc_overflowingAncestor(h){var f=[];var g=ssc_root.scrollHeight;do{var e=ssc_cache[ssc_uniqueID(h)];if(e){return ssc_setCache(f,e)}f.push(h);if(g===h.scrollHeight){if(!ssc_frame||ssc_root.clientHeight+10<g){return ssc_setCache(f,document.body)}}else{if(h.clientHeight+10<h.scrollHeight){overflow=getComputedStyle(h,"").getPropertyValue("overflow");if(overflow==="scroll"||overflow==="auto"){return ssc_setCache(f,h)}}}}while(h=h.parentNode)}function ssc_addEvent(d,e,f){window.addEventListener(d,e,f||false)}function ssc_removeEvent(d,e,f){window.removeEventListener(d,e,f||false)}function ssc_isNodeName(c,d){return c.nodeName.toLowerCase()===d.toLowerCase()}function ssc_directionCheck(c,d){c=c>0?1:-1;d=d>0?1:-1;if(ssc_direction.x!==c||ssc_direction.y!==d){ssc_direction.x=c;ssc_direction.y=d;ssc_que=[]}}function ssc_pulse_(h){var f,g,e;h=h*ssc_pulseScale;if(h<1){f=h-(1-Math.exp(-h))}else{g=Math.exp(-1);h-=1;e=1-Math.exp(-h);f=g+e*(1-g)}return f*ssc_pulseNormalize}function ssc_pulse(b){if(b>=1){return 1}if(b<=0){return 0}if(ssc_pulseNormalize==1){ssc_pulseNormalize/=ssc_pulse_(1)}return ssc_pulse_(b)}var ssc_framerate=150;var ssc_animtime=500;var ssc_stepsize=150;var ssc_pulseAlgorithm=true;var ssc_pulseScale=6;var ssc_pulseNormalize=1;var ssc_keyboardsupport=true;var ssc_arrowscroll=50;var ssc_frame=false;var ssc_direction={x:0,y:0};var ssc_initdone=false;var ssc_fixedback=true;var ssc_root=document.documentElement;var ssc_activeElement;var ssc_key={left:37,up:38,right:39,down:40,spacebar:32,pageup:33,pagedown:34,end:35,home:36};var ssc_que=[];var ssc_pending=false;var ssc_cache={};setInterval(function(){ssc_cache={}},10*1000);var ssc_uniqueID=function(){var b=0;return function(a){return a.ssc_uniqueID||(a.ssc_uniqueID=b++)}}();var ischrome=/chrome/.test(navigator.userAgent.toLowerCase());if(ischrome){ssc_addEvent("mousedown",ssc_mousedown);ssc_addEvent("mousewheel",ssc_wheel);ssc_addEvent("load",ssc_init)};

4 komentar

Rian N Herdian
JS SMOOTH SCROLL fungsi nya buat apa tuh gan?
reply Reply delete Delete
Rizky Kurniawan Ritonga
Fungsinya untuk memperhalus scrolling pada web browser di dekstop kang rian.

Posting Komentar

Blog ini tidak menerima komentar via OpenID atau Anonim.
Link aktif akan secara otomatis terhapus oleh sistem.
Untuk memasukkan link dengan aman, gunakan kode [url=http://sites.com]Teks Link[/url]
Untuk memasukkan kode, gunakan kode <i rel="code">Kode Kamu</i>
Untuk memasukkan kode yang panjang, gunakan kode <i rel="pre">Kode Panjang Kamu</i>
Untuk menyisipkan gambar, gunakan kode [img]Url Gambar[/img]
Untuk memasukkan title, gunakan kode <b rel="h4">Title kamu ...</b>
Untuk memberikan efek huruf tebal pada teks, gunakan kode <strong>Teks Kamu ...</strong>
Untuk memberikan efek huruf miring pada teks, gunakan kode <em>Teks Kamu ...</em>

Khusus untuk membalas komentar disarankan menggunakan tombol balas di samping komentar terkait dibandingkan menggunakan formulir komentar di bawah agar komunikasi lebih terstruktur. Karena mungkin, apa yang Anda tanyakan/katakan saat ini akan sangat bermanfaat bagi pembaca lain.

Emotikon
:) :( ^_^ :D ;) :-bd :'( :\ :p B) :Q :Ozz 7:( \o/ **p <3 0:) :-a 7:O *fck* x@ X@ ~x( :yaya: =p*

Cancel Reply