Bug 11516: make OPAC search term highlighting work in results browser
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / lib / greybox / AJS_fx.js
1 AJS.fx={_shades:{0:"ffffff",1:"ffffee",2:"ffffdd",3:"ffffcc",4:"ffffbb",5:"ffffaa",6:"ffff99"},highlight:function(_1,_2){
2 var _3=new AJS.fx.Base();
3 _3.elm=AJS.$(_1);
4 _3.setOptions(_2);
5 _3.options.duration=600;
6 AJS.update(_3,{increase:function(){
7 if(this.now==7){
8 _1.style.backgroundColor="transparent";
9 }else{
10 _1.style.backgroundColor="#"+AJS.fx._shades[Math.floor(this.now)];
11 }
12 }});
13 return _3.custom(6,0);
14 },fadeIn:function(_4,_5){
15 _5=_5||{};
16 if(!_5.from){
17 _5.from=0;
18 AJS.setOpacity(_4,0);
19 }
20 if(!_5.to){
21 _5.to=1;
22 }
23 var s=new AJS.fx.Style(_4,"opacity",_5);
24 return s.custom(_5.from,_5.to);
25 },fadeOut:function(_7,_8){
26 _8=_8||{};
27 if(!_8.from){
28 _8.from=1;
29 }
30 if(!_8.to){
31 _8.to=0;
32 }
33 _8.duration=300;
34 var s=new AJS.fx.Style(_7,"opacity",_8);
35 return s.custom(_8.from,_8.to);
36 },setWidth:function(_a,_b){
37 var s=new AJS.fx.Style(_a,"width",_b);
38 return s.custom(_b.from,_b.to);
39 },setHeight:function(_d,_e){
40 var s=new AJS.fx.Style(_d,"height",_e);
41 return s.custom(_e.from,_e.to);
42 }};
43 AJS.fx.Base=new AJS.Class({init:function(){
44 AJS.bindMethods(this);
45 },setOptions:function(_10){
46 this.options=AJS.update({onStart:function(){
47 },onComplete:function(){
48 },transition:AJS.fx.Transitions.sineInOut,duration:500,wait:true,fps:50},_10||{});
49 },step:function(){
50 var _11=new Date().getTime();
51 if(_11<this.time+this.options.duration){
52 this.cTime=_11-this.time;
53 this.setNow();
54 }else{
55 setTimeout(AJS.$b(this.options.onComplete,this,[this.elm]),10);
56 this.clearTimer();
57 this.now=this.to;
58 }
59 this.increase();
60 },setNow:function(){
61 this.now=this.compute(this.from,this.to);
62 },compute:function(_12,to){
63 var _14=to-_12;
64 return this.options.transition(this.cTime,_12,_14,this.options.duration);
65 },clearTimer:function(){
66 clearInterval(this.timer);
67 this.timer=null;
68 return this;
69 },_start:function(_15,to){
70 if(!this.options.wait){
71 this.clearTimer();
72 }
73 if(this.timer){
74 return;
75 }
76 setTimeout(AJS.$p(this.options.onStart,this.elm),10);
77 this.from=_15;
78 this.to=to;
79 this.time=new Date().getTime();
80 this.timer=setInterval(this.step,Math.round(1000/this.options.fps));
81 return this;
82 },custom:function(_17,to){
83 return this._start(_17,to);
84 },set:function(to){
85 this.now=to;
86 this.increase();
87 return this;
88 },setStyle:function(elm,_1b,val){
89 if(this.property=="opacity"){
90 AJS.setOpacity(elm,val);
91 }else{
92 AJS.setStyle(elm,_1b,val);
93 }
94 }});
95 AJS.fx.Style=AJS.fx.Base.extend({init:function(elm,_1e,_1f){
96 this.parent();
97 this.elm=elm;
98 this.setOptions(_1f);
99 this.property=_1e;
100 },increase:function(){
101 this.setStyle(this.elm,this.property,this.now);
102 }});
103 AJS.fx.Styles=AJS.fx.Base.extend({init:function(elm,_21){
104 this.parent();
105 this.elm=AJS.$(elm);
106 this.setOptions(_21);
107 this.now={};
108 },setNow:function(){
109 for(p in this.from){
110 this.now[p]=this.compute(this.from[p],this.to[p]);
111 }
112 },custom:function(obj){
113 if(this.timer&&this.options.wait){
114 return;
115 }
116 var _23={};
117 var to={};
118 for(p in obj){
119 _23[p]=obj[p][0];
120 to[p]=obj[p][1];
121 }
122 return this._start(_23,to);
123 },increase:function(){
124 for(var p in this.now){
125 this.setStyle(this.elm,p,this.now[p]);
126 }
127 }});
128 AJS.fx.Transitions={linear:function(t,b,c,d){
129 return c*t/d+b;
130 },sineInOut:function(t,b,c,d){
131 return -c/2*(Math.cos(Math.PI*t/d)-1)+b;
132 }};
133 script_loaded=true;
134
135
136 script_loaded=true;