PageSourceSearch

https://bsnews.info/wp-content/plugins/jetpack/_inc/spin.js

js bsnews.info collected 2026-09-25 23:58:21 UTC 5,387 bytes, 84 lines download raw bytes

1(function(root,factory){if(typeof exports=='object')module.exports=factory()
2else if(typeof define=='function'&&define.amd)define(factory)
3else root.Spinner=factory()}
4(this,function(){"use strict";var prefixes=['webkit','Moz','ms','O'],animations={},useCssAnimations
5function createEl(tag,prop){var el=document.createElement(tag||'div'),n
6for(n in prop)el[n]=prop[n]
7return el}
8function ins(parent){for(var i=1,n=arguments.length;i<n;i++)
9parent.appendChild(arguments[i])
10return parent}
11var sheet=(function(){var el=createEl('style',{type:'text/css'})
12ins(document.getElementsByTagName('head')[0],el)
13return el.sheet||el.styleSheet}())
14function addAnimation(alpha,trail,i,lines){var name=['opacity',trail,~~(alpha*100),i,lines].join('-'),start=0.01+ i/lines*100,z=Math.max(1-(1-alpha)/ trail * (100-start), alpha)
15,prefix=useCssAnimations.substring(0,useCssAnimations.indexOf('Animation')).toLowerCase(),pre=prefix&&'-'+ prefix+'-'||''
16if(!animations[name]){sheet.insertRule('@'+ pre+'keyframes '+ name+'{'+'0%{opacity:'+ z+'}'+
17start+'%{opacity:'+ alpha+'}'+
18(start+0.01)+'%{opacity:1}'+
19(start+trail)%100+'%{opacity:'+ alpha+'}'+'100%{opacity:'+ z+'}'+'}',sheet.cssRules.length)
20animations[name]=1}
21return name}
22function vendor(el,prop){var s=el.style,pp,i
23if(s[prop]!==undefined)return prop
24prop=prop.charAt(0).toUpperCase()+ prop.slice(1)
25for(i=0;i<prefixes.length;i++){pp=prefixes[i]+prop
26if(s[pp]!==undefined)return pp}}
27function css(el,prop){for(var n in prop)
28el.style[vendor(el,n)||n]=prop[n]
29return el}
30function merge(obj){for(var i=1;i<arguments.length;i++){var def=arguments[i]
31for(var n in def)
32if(obj[n]===undefined)obj[n]=def[n]}
33return obj}
34function pos(el){var o={x:el.offsetLeft,y:el.offsetTop}
35while((el=el.offsetParent))
36o.x+=el.offsetLeft,o.y+=el.offsetTop
37return o}
38var defaults={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:'#000',direction:1,speed:1,trail:100,opacity:1/4,fps:20,zIndex:2e9,className:'spinner',top:'auto',left:'auto',position:'relative'}
39function Spinner(o){if(typeof this=='undefined')return new Spinner(o)
40this.opts=merge(o||{},Spinner.defaults,defaults)}
41Spinner.defaults={}
42merge(Spinner.prototype,{spin:function(target){this.stop()
43var self=this,o=self.opts,el=self.el=css(createEl(0,{className:o.className}),{position:o.position,width:0,zIndex:o.zIndex}),mid=o.radius+o.length+o.width,ep,tp
44if(target){target.insertBefore(el,target.firstChild||null)
45tp=pos(target)
46ep=pos(el)
47css(el,{left:(o.left=='auto'?tp.x-ep.x+(target.offsetWidth>>1):parseInt(o.left,10)+ mid)+'px',top:(o.top=='auto'?tp.y-ep.y+(target.offsetHeight>>1):parseInt(o.top,10)+ mid)+'px'})}
48el.setAttribute('role','progressbar')
49self.lines(el,self.opts)
50if(!useCssAnimations){var i=0,start=(o.lines- 1)*(1- o.direction)/ 2
51,alpha,fps=o.fps,f=fps/o.speed,ostep=(1-o.opacity)/ (f*o.trail / 100)
52,astep=f/o.lines;(function anim(){i++;for(var j=0;j<o.lines;j++){alpha=Math.max(1-(i+(o.lines- j)*astep)%f*ostep,o.opacity)
53self.opacity(el,j*o.direction+ start,alpha,o)}
54self.timeout=self.el&&setTimeout(anim,~~(1000/fps))})()}
55return self},stop:function(){var el=this.el
56if(el){clearTimeout(this.timeout)
57if(el.parentNode)el.parentNode.removeChild(el)
58this.el=undefined}
59return this},lines:function(el,o){var i=0,start=(o.lines- 1)*(1- o.direction)/ 2
60,seg
61function fill(color,shadow){return css(createEl(),{position:'absolute',width:(o.length+o.width)+'px',height:o.width+'px',background:color,boxShadow:shadow,transformOrigin:'left',transform:'rotate('+~~(360/o.lines*i+o.rotate)+'deg) translate('+ o.radius+'px'+',0)',borderRadius:(o.corners*o.width>>1)+'px'})}
62for(;i<o.lines;i++){seg=css(createEl(),{position:'absolute',top:1+~(o.width/2)+'px',transform:o.hwaccel?'translate3d(0,0,0)':'',opacity:o.opacity,animation:useCssAnimations&&addAnimation(o.opacity,o.trail,start+ i*o.direction,o.lines)+' '+ 1/o.speed+'s linear infinite'})
63if(o.shadow)ins(seg,css(fill('#000','0 0 4px '+'#000'),{top:2+'px'}))
64ins(el,ins(seg,fill(o.color,'0 0 1px rgba(0,0,0,.1)')))}
65return el},opacity:function(el,i,val){if(i<el.childNodes.length)el.childNodes[i].style.opacity=val}})
66function initVML(){function vml(tag,attr){return createEl('<'+ tag+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',attr)}
67sheet.addRule('.spin-vml','behavior:url(#default#VML)')
68Spinner.prototype.lines=function(el,o){var r=o.length+o.width,s=2*r
69function grp(){return css(vml('group',{coordsize:s+' '+ s,coordorigin:-r+' '+-r}),{width:s,height:s})}
70var margin=-(o.width+o.length)*2+'px',g=css(grp(),{position:'absolute',top:margin,left:margin}),i
71function seg(i,dx,filter){ins(g,ins(css(grp(),{rotation:360/o.lines*i+'deg',left:~~dx}),ins(css(vml('roundrect',{arcsize:o.corners}),{width:r,height:o.width,left:o.radius,top:-o.width>>1,filter:filter}),vml('fill',{color:o.color,opacity:o.opacity}),vml('stroke',{opacity:0}
71))))}
72if(o.shadow)
73for(i=1;i<=o.lines;i++)
74seg(i,-2,'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)')
75for(i=1;i<=o.lines;i++)seg(i)
76return ins(el,g)}
77Spinner.prototype.opacity=function(el,i,val,o){var c=el.firstChild
78o=o.shadow&&o.lines||0
79if(c&&i+o<c.childNodes.length){c=c.childNodes[i+o];c=c&&c.firstChild;c=c&&c.firstChild
80if(c)c.opacity=val}}}
81var probe=css(createEl('group'),{behavior:'url(#default#VML)'})
82if(!vendor(probe,'transform')&&probe.adj)initVML()
83else useCssAnimations=vendor(probe,'animation')
84return Spinner}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.