Index: trunk/extensions/AjaxLoginJQ/jqModal.js |
— | — | @@ -1,69 +0,0 @@ |
2 | | -/* |
3 | | - * jqModal - Minimalist Modaling with jQuery |
4 | | - * (http://dev.iceburg.net/jquery/jqModal/) |
5 | | - * |
6 | | - * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net> |
7 | | - * Dual licensed under the MIT and GPL licenses: |
8 | | - * http://www.opensource.org/licenses/mit-license.php |
9 | | - * http://www.gnu.org/licenses/gpl.html |
10 | | - * |
11 | | - * $Version: 03/01/2009 +r14 |
12 | | - */ |
13 | | -(function($) { |
14 | | -$.fn.jqm=function(o){ |
15 | | -var p={ |
16 | | -overlay: 50, |
17 | | -overlayClass: 'jqmOverlay', |
18 | | -closeClass: 'jqmClose', |
19 | | -trigger: '.jqModal', |
20 | | -ajax: F, |
21 | | -ajaxText: '', |
22 | | -target: F, |
23 | | -modal: F, |
24 | | -toTop: F, |
25 | | -onShow: F, |
26 | | -onHide: F, |
27 | | -onLoad: F |
28 | | -}; |
29 | | -return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s; |
30 | | -H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s}; |
31 | | -if(p.trigger)$(this).jqmAddTrigger(p.trigger); |
32 | | -});}; |
33 | | - |
34 | | -$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');}; |
35 | | -$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');}; |
36 | | -$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t);});}; |
37 | | -$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});}; |
38 | | - |
39 | | -$.jqm = { |
40 | | -hash:{}, |
41 | | -open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z); |
42 | | - if(c.modal) {if(!A[0])L('bind');A.push(s);} |
43 | | - else if(c.overlay > 0)h.w.jqmAddClose(o); |
44 | | - else o=F; |
45 | | - |
46 | | - h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F; |
47 | | - if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}} |
48 | | - |
49 | | - if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u; |
50 | | - r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});} |
51 | | - else if(cc)h.w.jqmAddClose($(cc,h.w)); |
52 | | - |
53 | | - if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o); |
54 | | - (c.onShow)?c.onShow(h):h.w.show();e(h);return F; |
55 | | -}, |
56 | | -close:function(s){var h=H[s];if(!h.a)return F;h.a=F; |
57 | | - if(A[0]){A.pop();if(!A[0])L('unbind');} |
58 | | - if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove(); |
59 | | - if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F; |
60 | | -}, |
61 | | -params:{}}; |
62 | | -var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false, |
63 | | -i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}), |
64 | | -e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);}, |
65 | | -f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}}, |
66 | | -L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);}, |
67 | | -m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;}, |
68 | | -hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() { |
69 | | - if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});}; |
70 | | -})(jQuery); |
\ No newline at end of file |
Index: trunk/extensions/AjaxLogin/YAHOOTools.js |
— | — | @@ -1,663 +0,0 @@ |
2 | | -/* YAHOO.Tools JavaScript */ |
3 | | -YAHOO.Tools = function(){ |
4 | | - keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; |
5 | | - regExs = { |
6 | | - quotes:/\x22/g, |
7 | | - startspace:/^\s+/g, |
8 | | - endspace:/\s+$/g, |
9 | | - striptags:/<\/?[^>]+>/gi, |
10 | | - hasbr:/<br/i, |
11 | | - hasp:/<p>/i, |
12 | | - rbr:/<br>/gi, |
13 | | - rbr2:/<br\/>/gi, |
14 | | - rendp:/<\/p>/gi, |
15 | | - rp:/<p>/gi, |
16 | | - base64:/[^A-Za-z0-9\+\/\=]/g, |
17 | | - syntaxCheck:/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/ |
18 | | - } |
19 | | - jsonCodes = { |
20 | | - '\b':'\\b', |
21 | | - '\t':'\\t', |
22 | | - '\n':'\\n', |
23 | | - '\f':'\\f', |
24 | | - '\r':'\\r', |
25 | | - '"':'\\"', |
26 | | - '\\':'\\\\' |
27 | | - } |
28 | | - return { version:'1.0' } |
29 | | -}(); |
30 | | -YAHOO.Tools.getHeight = function(elm){ |
31 | | - var elm = $(elm); |
32 | | - var h = $D.getStyle(elm, 'height'); |
33 | | - |
34 | | - if( h== 'auto' ){ |
35 | | - elm.style.zoom = 1; |
36 | | - h = elm.clientHeight+'px'; |
37 | | - } |
38 | | - return h; |
39 | | -} |
40 | | -YAHOO.Tools.getCenter = function(elm){ |
41 | | - var elm = $(elm); |
42 | | - var cX = Math.round(($D.getViewportWidth()-parseInt($D.getStyle(elm,'width')))/2); |
43 | | - var cY = Math.round(($D.getViewportHeight()-parseInt(this.getHeight(elm)))/2); |
44 | | - return[cX,cY]; |
45 | | -} |
46 | | - |
47 | | -YAHOO.Tools.makeTextObject = function(txt){ |
48 | | - return document.createTextNode(txt); |
49 | | -} |
50 | | - |
51 | | -YAHOO.Tools.makeChildren = function(arr, elm){ |
52 | | - var elm = $(elm); |
53 | | - |
54 | | - for( var i in arr ){ |
55 | | - _val = arr[i]; |
56 | | - if( typeof _val == 'string' ){ |
57 | | - _val = this.makeTxtObject(_val); |
58 | | - } |
59 | | - elm.appendChild(_val); |
60 | | - } |
61 | | -} |
62 | | - |
63 | | -YAHOO.Tools.styleToCamel = function(str){ |
64 | | - var _tmp = str.split('-'); |
65 | | - var _new_style = _tmp[0]; |
66 | | - |
67 | | - for( var i = 1; i < _tmp.length; i++ ){ |
68 | | - _new_style+=_tmp[i].substring(0,1).toUpperCase()+_tmp[i].substring(1,_tmp[i].length); |
69 | | - } |
70 | | - return _new_style; |
71 | | -} |
72 | | - |
73 | | -YAHOO.Tools.removeQuotes = function(str){ |
74 | | - var checkText = new String(str); |
75 | | - return String( checkText.replace( regExs.quotes, '' ) ); |
76 | | -} |
77 | | - |
78 | | -YAHOO.Tools.trim = function(str){ |
79 | | - return str.replace(regExs.startspace,'').replace(regExs.endspace,''); |
80 | | -} |
81 | | - |
82 | | -YAHOO.Tools.stripTags = function(str){ |
83 | | - return str.replace(regExs.striptags,''); |
84 | | -} |
85 | | - |
86 | | -YAHOO.Tools.hasBRs = function(str){ |
87 | | - return str.match(regExs.hasbr) || str.match(regExs.hasp); |
88 | | -} |
89 | | - |
90 | | -YAHOO.Tools.convertBRs2NLs = function(str){ |
91 | | - return str.replace(regExs.rbr,"\n").replace(regExs.rbr2,"\n").replace(regExs.rendp,"\n").replace(regExs.rp,""); |
92 | | -} |
93 | | - |
94 | | -YAHOO.Tools.stringRepeat = function(str, repeat){ |
95 | | - return new Array(repeat+1).join(str); |
96 | | -} |
97 | | - |
98 | | -YAHOO.Tools.stringReverse = function(str){ |
99 | | - var new_str = ''; |
100 | | - for( i = 0; i < str.length; i++ ){ |
101 | | - new_str = new_str+str.charAt((str.length-1)-i); |
102 | | - } |
103 | | - return new_str; |
104 | | -} |
105 | | - |
106 | | -YAHOO.Tools.printf = function(){ |
107 | | - var num = arguments.length; |
108 | | - var oStr = arguments[0]; |
109 | | - |
110 | | - for( var i = 1; i < num; i++ ){ |
111 | | - var pattern = "\\{"+(i-1)+"\\}"; |
112 | | - var re = new RegExp(pattern,"g"); |
113 | | - oStr = oStr.replace(re,arguments[i]); |
114 | | - } |
115 | | - return oStr; |
116 | | -} |
117 | | - |
118 | | -YAHOO.Tools.setStyleString = function(el, str){ |
119 | | - var _tmp = str.split(';'); |
120 | | - for( x in _tmp ){ |
121 | | - if( x ){ |
122 | | - __tmp = YAHOO.Tools.trim(_tmp[x]); |
123 | | - __tmp = _tmp[x].split(':'); |
124 | | - if( __tmp[0] && __tmp[1] ){ |
125 | | - var _attr = YAHOO.Tools.trim(__tmp[0]); |
126 | | - var _val = YAHOO.Tools.trim(__tmp[1]); |
127 | | - if( _attr && _val ){ |
128 | | - if( _attr.indexOf('-')!=-1 ){ |
129 | | - _attr = YAHOO.Tools.styleToCamel(_attr); |
130 | | - } |
131 | | - $D.setStyle(el, _attr, _val); |
132 | | - } |
133 | | - } |
134 | | - } |
135 | | - } |
136 | | -} |
137 | | - |
138 | | -YAHOO.Tools.getSelection = function(_document, _window){ |
139 | | - if( !_document ){ |
140 | | - _document = document; |
141 | | - } |
142 | | - if( !_window ){ |
143 | | - _window = window; |
144 | | - } |
145 | | - if( _document.selection ){ |
146 | | - return _document.selection; |
147 | | - } |
148 | | - return _window.getSelection(); |
149 | | -} |
150 | | - |
151 | | -YAHOO.Tools.removeElement = function(el){ |
152 | | - if( !(el instanceof Array) ){ |
153 | | - el = new Array($(el)); |
154 | | - } |
155 | | - |
156 | | - for( var i = 0; i < el.length; i++ ){ |
157 | | - if( el[i].parentNode ){ |
158 | | - el[i].parentNode.removeChild(el); |
159 | | - } |
160 | | - } |
161 | | -} |
162 | | - |
163 | | -YAHOO.Tools.setCookie = function(name, value, expires, path, domain, secure){ |
164 | | - var argv = arguments; |
165 | | - var argc = arguments.length; |
166 | | - var expires = ( argc > 2 ) ? argv[2] : null; |
167 | | - var path = ( argc > 3 ) ? argv[3] : '/'; |
168 | | - var domain = ( argc > 4 ) ? argv[4] : null; |
169 | | - var secure = ( argc > 5 ) ? argv[5] : false; |
170 | | - |
171 | | - document.cookie = name+"="+escape(value)+ ((expires==null)?"":("; expires="+expires.toGMTString()))+ ((path==null)?"":("; path="+path))+ ((domain==null)?"":("; domain="+domain))+ ((secure==true)?"; secure":""); |
172 | | -} |
173 | | - |
174 | | -YAHOO.Tools.getCookie = function(name){ |
175 | | - var dc = document.cookie; |
176 | | - var prefix = name+'='; |
177 | | - var begin = dc.indexOf('; '+prefix); |
178 | | - |
179 | | - if( begin == -1 ){ |
180 | | - begin = dc.indexOf(prefix); |
181 | | - if( begin != 0 ) |
182 | | - return null; |
183 | | - } else { |
184 | | - begin+=2; |
185 | | - } |
186 | | - |
187 | | - var end = document.cookie.indexOf(';',begin); |
188 | | - if( end==-1 ){ |
189 | | - end = dc.length; |
190 | | - } |
191 | | - return unescape(dc.substring(begin+prefix.length,end)); |
192 | | -} |
193 | | - |
194 | | -YAHOO.Tools.deleteCookie = function(name, path, domain){ |
195 | | - if( getCookie(name) ){ |
196 | | - document.cookie = name+'='+((path)?'; path='+path:'')+((domain)?'; domain='+domain:'')+'; expires=Thu, 01-Jan-70 00:00:01 GMT'; |
197 | | - } |
198 | | -} |
199 | | - |
200 | | -YAHOO.Tools.getBrowserEngine = function(){ |
201 | | - var opera = ( ( window.opera && window.opera.version ) ? true : false ); |
202 | | - var safari= ( ( navigator.vendor && navigator.vendor.indexOf('Apple') != -1 ) ? true : false ); |
203 | | - var gecko = ( ( document.getElementById && !document.all && !opera && !safari ) ? true : false ); |
204 | | - var msie = ( ( window.ActiveXObject ) ? true : false); |
205 | | - var version = false; |
206 | | - |
207 | | - if( msie ){ |
208 | | - if( typeof document.body.style.maxHeight != "undefined" ){ |
209 | | - version = '7'; |
210 | | - } else { |
211 | | - version = '6'; |
212 | | - } |
213 | | - } |
214 | | - |
215 | | - if( opera ){ |
216 | | - var tmp_version = window.opera.version().split('.'); |
217 | | - version = tmp_version[0]+'.'+tmp_version[1]; |
218 | | - } |
219 | | - |
220 | | - if( gecko ){ |
221 | | - if( navigator.registerContentHandler ){ |
222 | | - version = '2'; |
223 | | - } else { |
224 | | - version = '1.5'; |
225 | | - } |
226 | | - if( (navigator.vendorSub) && !version ){ |
227 | | - version = navigator.vendorSub; |
228 | | - } |
229 | | - } |
230 | | - |
231 | | - if( safari ){ |
232 | | - try { |
233 | | - if( console ){ |
234 | | - if( (window.onmousewheel !== 'undefined') && (window.onmousewheel === null) ){ |
235 | | - version = '2'; |
236 | | - } else { |
237 | | - version = '1.3'; |
238 | | - } |
239 | | - } |
240 | | - } catch(e){ |
241 | | - version = '1.2'; |
242 | | - } |
243 | | - } |
244 | | - var browsers = { ua:navigator.userAgent, opera:opera, safari:safari, gecko:gecko, msie:msie, version:version } |
245 | | - return browsers; |
246 | | -} |
247 | | - |
248 | | -YAHOO.Tools.getBrowserAgent = function(){ |
249 | | - var ua = navigator.userAgent.toLowerCase(); |
250 | | - var opera = ( ( ua.indexOf('opera') != -1 ) ? true : false ); |
251 | | - var safari = ( ( ua.indexOf('safari') != -1 ) ? true : false ); |
252 | | - var firefox = ( ( ua.indexOf('firefox') != -1 ) ? true : false ); |
253 | | - var msie = ( ( ua.indexOf('msie') != -1 ) ? true : false ); |
254 | | - var mac = ( ( ua.indexOf('mac') != -1 ) ? true : false ); |
255 | | - var unix = ( ( ua.indexOf('x11') != -1 ) ? true : false ); |
256 | | - var win = ( ( mac || unix ) ? false : true ); |
257 | | - var version = false; |
258 | | - var mozilla = false; |
259 | | - |
260 | | - if( !firefox && !safari && ( ua.indexOf('gecko') != -1 ) ){ |
261 | | - mozilla = true; |
262 | | - var _tmp = ua.split('/'); |
263 | | - version = _tmp[_tmp.length-1].split(' ')[0]; |
264 | | - } |
265 | | - |
266 | | - if( firefox ){ |
267 | | - var _tmp = ua.split('/'); |
268 | | - version = _tmp[_tmp.length-1].split(' ')[0]; |
269 | | - } |
270 | | - |
271 | | - if( msie ){ |
272 | | - version = ua.substring((ua.indexOf('msie ')+5)).split(';')[0]; |
273 | | - } |
274 | | - |
275 | | - if( safari ){ |
276 | | - version = this.getBrowserEngine().version; |
277 | | - } |
278 | | - |
279 | | - if( opera ){ |
280 | | - version = ua.substring((ua.indexOf('opera/')+6)).split(' ')[0]; |
281 | | - } |
282 | | - |
283 | | - var browsers = { ua:navigator.userAgent, opera:opera, safari:safari, firefox:firefox, mozilla:mozilla, msie:msie, mac:mac, win:win, unix:unix, version:version } |
284 | | - return browsers; |
285 | | -} |
286 | | - |
287 | | -YAHOO.Tools.checkFlash = function(){ |
288 | | - var br = this.getBrowserEngine(); |
289 | | - |
290 | | - if( br.msie ){ |
291 | | - try { |
292 | | - var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); |
293 | | - var versionStr = axo.GetVariable("$version"); |
294 | | - var tempArray = versionStr.split(" "); |
295 | | - var tempString = tempArray[1]; |
296 | | - var versionArray = tempString.split(","); |
297 | | - var flash = versionArray[0]; |
298 | | - } catch(e) { |
299 | | - } |
300 | | - } else { |
301 | | - var flashObj = null; |
302 | | - var tokens, len, curr_tok; |
303 | | - if( navigator.mimeTypes && navigator.mimeTypes['application/x-shockwave-flash'] ){ |
304 | | - flashObj = navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin; |
305 | | - } |
306 | | - if( flashObj == null ){ |
307 | | - flash = false; |
308 | | - } else { |
309 | | - tokens = navigator.plugins['Shockwave Flash'].description.split(' '); |
310 | | - len = tokens.length; |
311 | | - while( len-- ){ |
312 | | - curr_tok = tokens[len]; |
313 | | - if( !isNaN(parseInt(curr_tok) ) ){ |
314 | | - hasVersion = curr_tok; |
315 | | - flash = hasVersion; |
316 | | - break; |
317 | | - } |
318 | | - } |
319 | | - } |
320 | | - } |
321 | | - return flash; |
322 | | -} |
323 | | - |
324 | | -YAHOO.Tools.setAttr = function(attrsObj, elm){ |
325 | | - if( typeof elm == 'string' ){ |
326 | | - elm = $(elm); |
327 | | - } |
328 | | - for( var i in attrsObj ){ |
329 | | - switch( i.toLowerCase() ){ |
330 | | - case 'listener': |
331 | | - if( attrsObj[i] instanceof Array ){ |
332 | | - var ev = attrsObj[i][0]; |
333 | | - var func = attrsObj[i][1]; |
334 | | - var base = attrsObj[i][2]; |
335 | | - var scope = attrsObj[i][3]; |
336 | | - $E.addListener(elm, ev, func, base, scope); |
337 | | - } |
338 | | - break; |
339 | | - case 'classname': |
340 | | - case 'class': |
341 | | - elm.className = attrsObj[i]; |
342 | | - break; |
343 | | - case 'style': |
344 | | - YAHOO.Tools.setStyleString(elm, attrsObj[i]); |
345 | | - break; |
346 | | - default: |
347 | | - elm.setAttribute(i, attrsObj[i]); |
348 | | - break; |
349 | | - } |
350 | | - } |
351 | | -} |
352 | | - |
353 | | -YAHOO.Tools.create = function(tagName){ |
354 | | - tagName = tagName.toLowerCase(); |
355 | | - elm = document.createElement(tagName); |
356 | | - var txt = false; |
357 | | - var attrsObj = false; |
358 | | - |
359 | | - if( !elm ){ |
360 | | - return false; |
361 | | - } |
362 | | - |
363 | | - for( var i = 1; i < arguments.length; i++ ){ |
364 | | - txt = arguments[i]; |
365 | | - if( typeof txt == 'string' ){ |
366 | | - _txt = YAHOO.Tools.makeTextObject(txt); |
367 | | - elm.appendChild(_txt); |
368 | | - } else if( txt instanceof Array ){ |
369 | | - YAHOO.Tools.makeChildren(txt, elm); |
370 | | - } else if( typeof txt == 'object' ){ |
371 | | - YAHOO.Tools.setAttr(txt, elm); |
372 | | - } |
373 | | - } |
374 | | - return elm; |
375 | | -} |
376 | | - |
377 | | -YAHOO.Tools.insertAfter = function(elm, curNode){ |
378 | | - if( curNode.nextSibling ){ |
379 | | - curNode.parentNode.insertBefore(elm, curNode.nextSibling); |
380 | | - } else { |
381 | | - curNode.parentNode.appendChild(elm); |
382 | | - } |
383 | | -} |
384 | | - |
385 | | -YAHOO.Tools.inArray = function(arr, val){ |
386 | | - if( arr instanceof Array ){ |
387 | | - for( var i = (arr.length-1); i>=0;i-- ){ |
388 | | - if( arr[i] === val ){ |
389 | | - return true; |
390 | | - } |
391 | | - } |
392 | | - } |
393 | | - return false; |
394 | | -} |
395 | | - |
396 | | -YAHOO.Tools.checkBoolean = function(str){ |
397 | | - return ( ( typeof str == 'boolean' ) ? true : false ); |
398 | | -} |
399 | | - |
400 | | -YAHOO.Tools.checkNumber = function(str){ |
401 | | - return ( ( isNaN(str) ) ? false : true ); |
402 | | -} |
403 | | - |
404 | | -YAHOO.Tools.PixelToEm = function(size){ |
405 | | - var data = {}; |
406 | | - var sSize = (size/13); |
407 | | - |
408 | | - data.other = (Math.round(sSize*100)/100); |
409 | | - data.msie = (Math.round((sSize*0.9759)*100)/100); |
410 | | - return data; |
411 | | -} |
412 | | - |
413 | | -YAHOO.Tools.PixelToEmStyle = function(size, prop){ |
414 | | - var data = ''; |
415 | | - var prop = ( ( prop ) ? prop.toLowerCase() : 'width' ); |
416 | | - var sSize = (size/13); |
417 | | - |
418 | | - data+= prop+':'+(Math.round(sSize*100)/100)+'em;'; |
419 | | - data+= '*'+prop+':'+(Math.round((sSize*0.9759)*100)/100)+'em;'; |
420 | | - if( ( prop == 'width' ) || ( prop == 'height' ) ){ |
421 | | - data+='min-'+prop+':'+size+'px;'; |
422 | | - } |
423 | | - return data; |
424 | | -} |
425 | | - |
426 | | -YAHOO.Tools.base64Encode = function(str){ |
427 | | - var data = ""; |
428 | | - var chr1, chr2, chr3, enc1, enc2, enc3, enc4; |
429 | | - var i = 0; |
430 | | - do { |
431 | | - chr1 = str.charCodeAt(i++); |
432 | | - chr2 = str.charCodeAt(i++); |
433 | | - chr3 = str.charCodeAt(i++); |
434 | | - enc1 = chr1>>2; |
435 | | - enc2 = ( ( chr1 & 3 ) << 4 ) | ( chr2 >> 4 ); |
436 | | - enc3 = ( ( chr2 & 15 ) << 2 ) | ( chr3 >> 6 ); |
437 | | - enc4 = chr3 & 63; |
438 | | - if( isNaN(chr2) ){ |
439 | | - enc3 = enc4 = 64; |
440 | | - } else if( isNaN(chr3) ){ |
441 | | - enc4 = 64; |
442 | | - } |
443 | | - data = data+keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4); |
444 | | - } |
445 | | - while( i < str.length ); |
446 | | - return data; |
447 | | -} |
448 | | - |
449 | | -YAHOO.Tools.base64Decode = function(str){ |
450 | | - var data = ""; |
451 | | - var chr1, chr2, chr3, enc1, enc2, enc3, enc4; |
452 | | - var i = 0; |
453 | | - str = str.replace(regExs.base64,""); |
454 | | - |
455 | | - do { |
456 | | - enc1 = keyStr.indexOf(str.charAt(i++)); |
457 | | - enc2 = keyStr.indexOf(str.charAt(i++)); |
458 | | - enc3 = keyStr.indexOf(str.charAt(i++)); |
459 | | - enc4 = keyStr.indexOf(str.charAt(i++)); |
460 | | - chr1 = ( enc1 << 2 ) | ( enc2 >> 4 ); |
461 | | - chr2 = ( ( enc2 & 15 ) << 4 ) | ( enc3 >> 2); |
462 | | - chr3 = ( ( enc3 & 3 ) << 6 ) | enc4; |
463 | | - data = data+String.fromCharCode(chr1); |
464 | | - if( enc3 != 64 ){ |
465 | | - data = data+String.fromCharCode(chr2); |
466 | | - } |
467 | | - if( enc4 != 64 ){ |
468 | | - data = data+String.fromCharCode(chr3); |
469 | | - } |
470 | | - } |
471 | | - while( i < str.length ); |
472 | | - return data; |
473 | | -} |
474 | | - |
475 | | -YAHOO.Tools.getQueryString = function(str){ |
476 | | - var qstr = {}; |
477 | | - if( !str ){ |
478 | | - var str = location.href.split('?'); |
479 | | - if( str.length != 2 ){ |
480 | | - str = ['', location.href]; |
481 | | - } |
482 | | - } else { |
483 | | - var str = ['', str]; |
484 | | - } |
485 | | - if( str[1].match('#') ){ |
486 | | - var _tmp = str[1].split('#'); |
487 | | - qstr.hash = _tmp[1]; |
488 | | - str[1] = _tmp[0]; |
489 | | - } |
490 | | - if( str[1] ){ |
491 | | - str = str[1].split('&'); |
492 | | - if( str.length ){ |
493 | | - for( var i = 0; i < str.length; i++ ){ |
494 | | - var part = str[i].split('='); |
495 | | - if( part[0].indexOf('[') != -1 ){ |
496 | | - if( part[0].indexOf('[]') != -1 ){ |
497 | | - var arr = part[0].substring(0,part[0].length-2); |
498 | | - if( !qstr[arr] ){ |
499 | | - qstr[arr] = []; |
500 | | - } |
501 | | - qstr[arr][qstr[arr].length] = part[1]; |
502 | | - } else { |
503 | | - var arr = part[0].substring(0,part[0].indexOf('[')); |
504 | | - var data = part[0].substring((part[0].indexOf('[')+1),part[0].indexOf(']')); |
505 | | - if( !qstr[arr] ){ |
506 | | - qstr[arr] = {}; |
507 | | - } |
508 | | - qstr[arr][data] = part[1]; |
509 | | - } |
510 | | - } else { |
511 | | - qstr[part[0]] = part[1]; |
512 | | - } |
513 | | - } |
514 | | - } |
515 | | - } |
516 | | - return qstr; |
517 | | -} |
518 | | - |
519 | | -YAHOO.Tools.getQueryStringVar = function(str){ |
520 | | - var qs = this.getQueryString(); |
521 | | - if( qs[str] ){ |
522 | | - return qs[str]; |
523 | | - } else { |
524 | | - return false; |
525 | | - } |
526 | | -} |
527 | | - |
528 | | -YAHOO.Tools.padDate = function(n){ |
529 | | - return n < 10 ? '0'+n : n; |
530 | | -} |
531 | | - |
532 | | -YAHOO.Tools.encodeStr = function(str){ |
533 | | - if( /["\\\x00-\x1f]/.test(str) ){ |
534 | | - return '"' + str.replace( /([\x00-\x1f\\"])/g, |
535 | | - function(a, b){ |
536 | | - var c = jsonCodes[b]; |
537 | | - if( c ){ |
538 | | - return c; |
539 | | - } |
540 | | - c = b.charCodeAt(); |
541 | | - return '\\u00' + Math.floor(c/16).toString(16) + (c%16).toString(16); |
542 | | - } |
543 | | - ) + '"'; |
544 | | - } |
545 | | - return'"'+str+'"'; |
546 | | -} |
547 | | - |
548 | | -YAHOO.Tools.encodeArr = function(arr){ |
549 | | - var a = ['['], b, i, l = arr.length, v; |
550 | | - for( i = 0; i < l; i+= 1 ){ |
551 | | - v = arr[i]; |
552 | | - switch( typeof v ){ |
553 | | - case 'undefined': |
554 | | - case 'function': |
555 | | - case 'unknown': |
556 | | - break; |
557 | | - default: |
558 | | - if( b ){ |
559 | | - a.push(','); |
560 | | - } |
561 | | - a.push( v === null ? "null" : YAHOO.Tools.JSONEncode(v) ); |
562 | | - b = true; |
563 | | - } |
564 | | - } |
565 | | - a.push(']'); |
566 | | - return a.join(''); |
567 | | -} |
568 | | - |
569 | | -YAHOO.Tools.encodeDate = function(d){ |
570 | | - return '"'+d.getFullYear()+'-'+YAHOO.Tools.padDate(d.getMonth()+1)+'-'+YAHOO.Tools.padDate(d.getDate())+'T'+YAHOO.Tools.padDate(d.getHours())+':'+YAHOO.Tools.padDate(d.getMinutes())+':'+YAHOO.Tools.padDate(d.getSeconds())+'"'; |
571 | | -} |
572 | | - |
573 | | -YAHOO.Tools.fixJSONDate = function(dateStr){ |
574 | | - var tmp = dateStr.split('T'); |
575 | | - var fixedDate = dateStr; |
576 | | - |
577 | | - if( tmp.length == 2 ){ |
578 | | - var tmpDate = tmp[0].split('-'); |
579 | | - if( tmpDate.length == 3 ){ |
580 | | - fixedDate = new Date(tmpDate[0], (tmpDate[1]-1), tmpDate[2]); |
581 | | - var tmpTime = tmp[1].split(':'); |
582 | | - if( tmpTime.length == 3 ){ |
583 | | - fixedDate.setHours(tmpTime[0], tmpTime[1], tmpTime[2]); |
584 | | - } |
585 | | - } |
586 | | - } |
587 | | - return fixedDate; |
588 | | -} |
589 | | - |
590 | | -YAHOO.Tools.JSONEncode = function(o){ |
591 | | - if( ( typeof o == 'undefined' ) || ( o === null ) ){ |
592 | | - return 'null'; |
593 | | - } else if( o instanceof Array ){ |
594 | | - return YAHOO.Tools.encodeArr(o); |
595 | | - } else if( o instanceof Date ){ |
596 | | - return YAHOO.Tools.encodeDate(o); |
597 | | - } else if( typeof o == 'string' ){ |
598 | | - return YAHOO.Tools.encodeStr(o); |
599 | | - } else if( typeof o == 'number' ){ |
600 | | - return isFinite(o) ? String(o) : "null"; |
601 | | - } else if( typeof o == 'boolean' ){ |
602 | | - return String(o); |
603 | | - } else { |
604 | | - var a = ['{'],b,i,v; |
605 | | - for( var i in o ){ |
606 | | - v = o[i]; |
607 | | - switch( typeof v ){ |
608 | | - case 'undefined': |
609 | | - case 'function': |
610 | | - case 'unknown': |
611 | | - break; |
612 | | - default: |
613 | | - if( b ){ |
614 | | - a.push(','); |
615 | | - } |
616 | | - a.push(YAHOO.Tools.JSONEncode(i),':',( ( v === null ) ? "null" : YAHOO.Tools.JSONEncode(v) ) ); |
617 | | - b = true; |
618 | | - } |
619 | | - } |
620 | | - a.push('}'); |
621 | | - return a.join(''); |
622 | | - } |
623 | | -} |
624 | | - |
625 | | -YAHOO.Tools.JSONParse = function(json, autoDate){ |
626 | | - var autoDate = ( ( autoDate ) ? true : false ); |
627 | | - |
628 | | - try { |
629 | | - if( regExs.syntaxCheck.test(json) ){ |
630 | | - var j = eval('('+json+')'); |
631 | | - if(autoDate){ |
632 | | - function walk(k, v){ |
633 | | - if( v && typeof v === 'object' ){ |
634 | | - for( var i in v ){ |
635 | | - if( v.hasOwnProperty(i) ){ |
636 | | - v[i] = walk(i,v[i]); |
637 | | - } |
638 | | - } |
639 | | - } |
640 | | - if( k.toLowerCase().indexOf('date')>=0 ){ |
641 | | - return YAHOO.Tools.fixJSONDate(v); |
642 | | - } else { |
643 | | - return v; |
644 | | - } |
645 | | - } |
646 | | - return walk('',j); |
647 | | - } else { |
648 | | - return j; |
649 | | - } |
650 | | - } |
651 | | - } catch(e){ |
652 | | - console.log(e); |
653 | | - } |
654 | | - throw new SyntaxError("parseJSON"); |
655 | | -} |
656 | | -YAHOO.tools = YAHOO.Tools; |
657 | | -YAHOO.TOOLS = YAHOO.Tools; |
658 | | -YAHOO.util.Dom.create = YAHOO.Tools.create; |
659 | | -$A = YAHOO.util.Anim; |
660 | | -$E = YAHOO.util.Event; |
661 | | -$D = YAHOO.util.Dom; |
662 | | -$T = YAHOO.Tools; |
663 | | -$ = YAHOO.util.Dom.get; |
664 | | -$$ = YAHOO.util.Dom.getElementsByClassName; |
\ No newline at end of file |
Index: trunk/extensions/AjaxLogin/AjaxLogin.i18n.php |
— | — | @@ -18,6 +18,9 @@ |
19 | 19 | 'ajaxLogin2' => 'Are you sure? |
20 | 20 | You may lose your changes to this page if you leave this page now.', |
21 | 21 | 'ajaxlogin-create' => 'Create an account', |
| 22 | + 'nosuchuser' => 'There is no user by the name "$1". |
| 23 | +User names are case sensitive. |
| 24 | +Check your spelling.', |
22 | 25 | ); |
23 | 26 | |
24 | 27 | /** Message documentation (Message documentation) |
— | — | @@ -288,7 +291,7 @@ |
289 | 292 | */ |
290 | 293 | $messages['hil'] = array( |
291 | 294 | 'ajaxlogin-desc' => 'Ang Dinamik box ay gapasugot sa mga naga-usar nga makasulod kag magapadumdom sang password', |
292 | | - 'ajaxLogin1' => 'Para ma kumpleto ang imo pagsulod, kinahanglan nga magabutang ka sang bag-o nga pasword. |
| 295 | + 'ajaxLogin1' => 'Para ma kumpleto ang imo pagsulod, kinahanglan nga magabutang ka sang bag-o nga pasword. |
293 | 296 | Dayon magahalin ka diri sa ini nga pahina nga gina-islan kag madula ang imo gina islan subong.', |
294 | 297 | 'ajaxLogin2' => 'Sigurado ka bala? |
295 | 298 | Basi madula ang mga ginpang obra mo sa diri nga pahina kung mahalin ka subong sa diri nga pahina.', |
— | — | @@ -677,7 +680,7 @@ |
678 | 681 | */ |
679 | 682 | $messages['te'] = array( |
680 | 683 | 'ajaxlogin-desc' => 'అప్పటికప్పుడు వాడుకరులను లాగిన్ అవ్వమని మరియు సంకేత పదం గుర్తు చేయమనేందుకు వాడే పెట్టె', |
681 | | - 'ajaxLogin1' => 'మీరు లోనికి ప్రవేశించాలంటే కొత్త సంకేత పదమును ఎన్నుకోవాలి. |
| 684 | + 'ajaxLogin1' => 'మీరు లోనికి ప్రవేశించాలంటే కొత్త సంకేత పదమును ఎన్నుకోవాలి. |
682 | 685 | ఈ చర్య మిమ్మలిని మార్చు పేజీ నుంచి అవతలకు తీసుకేడుతుంది. మీరు చేసిన మార్పులు చేరిగిపోవచ్చు.', |
683 | 686 | 'ajaxLogin2' => 'మీకు సమ్మతమేనా? |
684 | 687 | మీరు ఈ పేజీని వదిలి వెళితే ఇప్పటి దాకా ఈ పేజీకి చేసిన మార్పులను కోల్పోవచ్చు.', |
Index: trunk/extensions/AjaxLogin/AjaxLogin.php |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | * |
6 | 6 | * @file |
7 | 7 | * @ingroup Extensions |
8 | | - * @version 1.1.1 |
| 8 | + * @version 2.0.0 |
9 | 9 | * @author Inez Korczyński <korczynski(at)gmail(dot)com> |
10 | 10 | * @author Jack Phoenix <jack@countervandalism.net> |
11 | 11 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | $wgExtensionCredits['other'][] = array( |
20 | 20 | 'path' => __FILE__, |
21 | 21 | 'name' => 'AjaxLogin', |
22 | | - 'version' => '1.1.1', |
| 22 | + 'version' => '2.0.0', |
23 | 23 | 'author' => array( 'Inez Korczyński', 'Jack Phoenix' ), |
24 | 24 | 'description' => 'Dynamic box which allow users to login and remind password', |
25 | 25 | 'url' => 'http://www.mediawiki.org/wiki/Extension:AjaxLogin', |
— | — | @@ -58,19 +58,14 @@ |
59 | 59 | return true; |
60 | 60 | } |
61 | 61 | |
62 | | - // YUI library dependencies |
63 | | - // Utilities.js -- contains all stuff required by AjaxLogin and a tad bit more... |
64 | | - $out->addScript( '<script language="javascript" type="' . $wgJsMimeType . '" src="http://yui.yahooapis.com/2.6.0/build/utilities/utilities.js"></script>' . "\n" ); |
65 | | - // DragDrop |
66 | | - $out->addScript( '<script language="javascript" type="' . $wgJsMimeType . '" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>' . "\n" ); |
67 | | - // YUI styles -- these introduce some CSS warnings when included... |
68 | | - $out->addExtensionStyle( 'http://yui.yahooapis.com/2.7.0/build/container/assets/container.css' ); |
69 | | - $out->addExtensionStyle( 'http://yui.yahooapis.com/2.7.0/build/container/assets/container-core.css' ); |
| 62 | + |
70 | 63 | // Our custom CSS |
71 | 64 | $out->addStyle( '../..' . $wgScriptPath . '/extensions/AjaxLogin/AjaxLogin.css' ); |
72 | | - // AjaxLogin's own JS file + YAHOOTools.js (because AjaxLogin.js calls a couple YAHOO.Tools functions...) |
| 65 | + // JQuery and JQModal scripts |
| 66 | + $out->addScriptFile( $wgScriptPath . '/extensions/AjaxLogin/jquery-1.3.2.min.js' ); |
| 67 | + $out->addScriptFile( $wgScriptPath . '/extensions/AjaxLogin/jqModal.js' ); |
73 | 68 | $out->addScriptFile( $wgScriptPath . '/extensions/AjaxLogin/AjaxLogin.js' ); |
74 | | - $out->addScriptFile( $wgScriptPath . '/extensions/AjaxLogin/YAHOOTools.js' ); |
| 69 | + |
75 | 70 | return true; |
76 | 71 | } |
77 | 72 | |
— | — | @@ -106,12 +101,19 @@ |
107 | 102 | $titleObj = SpecialPage::getTitleFor( 'Userlogin' ); |
108 | 103 | $link = $titleObj->getLocalUrl( 'type=signup' ); |
109 | 104 | $wgOut->addHTML( '<!--[if lt IE 9]><style type="text/css">#userloginRound { width: 350px !important; }</style><![endif]--> |
110 | | -<div id="userloginRound" class="roundedDiv yui-module yui-overlay yui-panel" style="display:none; background:none; border:none;"> |
| 105 | + <div id="userloginRound" class="roundedDiv jqmWindow"> |
111 | 106 | <b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b> |
112 | 107 | <div class="r_boxContent"> |
113 | | - <div class="boxHeader color1">' . wfMsg( 'login' ) . '</div> |
| 108 | + <div> |
| 109 | + <div name="wpClose" id="wpClose" value="' . wfMsg( 'close' ) . '" style ="float:right;cursor:pointer;"><a href="#" tabindex="108"><font size="4" color="white"><b>X</b></font></a> |
| 110 | + </div> |
| 111 | + <div class="boxHeader color1"> |
| 112 | + ' . wfMsg( 'login' ) . ' |
| 113 | + </div> |
| 114 | + </div> |
114 | 115 | <form action="" method="post" name="userajaxloginform" id="userajaxloginform" style="margin:5px"> |
115 | | - <div id="wpError" style="width: 250px; line-height: 1.4em"></div> |
| 116 | + <div id="wpError" style="width: 250px; line-height: 1.4em;"></div> |
| 117 | + <label>' . wfMsg( 'loginprompt' ) . '</label><br /><br/> |
116 | 118 | <label for="wpName1">' . wfMsg( 'yourname' ) . '</label><br /> |
117 | 119 | <input type="text" class="loginText" name="wpName" id="wpName1" tabindex="101" size="20" /><br /> |
118 | 120 | <label for="wpPassword1">' . wfMsg( 'yourpassword' ) . '</label><br /> |
— | — | @@ -127,9 +129,8 @@ |
128 | 130 | } |
129 | 131 | // Originally this used core message 'nologinlink' but it wouldn't work too well for Finnish, so I changed it. --Jack Phoenix |
130 | 132 | wfLoadExtensionMessages( 'AjaxLogin' ); |
131 | | - $wgOut->addHTML( '<br /><a id="wpAjaxRegister" href="' . htmlspecialchars( $link ) . '">' . wfMsg( 'ajaxlogin-create' ) . '</a> |
| 133 | + $wgOut->addHTML( '<br /><a id="wpAjaxRegister" tabindex="107" href="' . htmlspecialchars( $link ) . '">' . wfMsg( 'ajaxlogin-create' ) . '</a> |
132 | 134 | </form> |
133 | | - |
134 | 135 | </div> |
135 | 136 | <b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b> |
136 | 137 | </div>' ); |
Index: trunk/extensions/AjaxLogin/jqModal.js |
— | — | @@ -0,0 +1,69 @@ |
| 2 | +/* |
| 3 | + * jqModal - Minimalist Modaling with jQuery |
| 4 | + * (http://dev.iceburg.net/jquery/jqModal/) |
| 5 | + * |
| 6 | + * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net> |
| 7 | + * Dual licensed under the MIT and GPL licenses: |
| 8 | + * http://www.opensource.org/licenses/mit-license.php |
| 9 | + * http://www.gnu.org/licenses/gpl.html |
| 10 | + * |
| 11 | + * $Version: 03/01/2009 +r14 |
| 12 | + */ |
| 13 | +(function($) { |
| 14 | +$.fn.jqm=function(o){ |
| 15 | +var p={ |
| 16 | +overlay: 50, |
| 17 | +overlayClass: 'jqmOverlay', |
| 18 | +closeClass: 'jqmClose', |
| 19 | +trigger: '.jqModal', |
| 20 | +ajax: F, |
| 21 | +ajaxText: '', |
| 22 | +target: F, |
| 23 | +modal: F, |
| 24 | +toTop: F, |
| 25 | +onShow: F, |
| 26 | +onHide: F, |
| 27 | +onLoad: F |
| 28 | +}; |
| 29 | +return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s; |
| 30 | +H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s}; |
| 31 | +if(p.trigger)$(this).jqmAddTrigger(p.trigger); |
| 32 | +});}; |
| 33 | + |
| 34 | +$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');}; |
| 35 | +$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');}; |
| 36 | +$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t);});}; |
| 37 | +$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});}; |
| 38 | + |
| 39 | +$.jqm = { |
| 40 | +hash:{}, |
| 41 | +open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z); |
| 42 | + if(c.modal) {if(!A[0])L('bind');A.push(s);} |
| 43 | + else if(c.overlay > 0)h.w.jqmAddClose(o); |
| 44 | + else o=F; |
| 45 | + |
| 46 | + h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F; |
| 47 | + if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}} |
| 48 | + |
| 49 | + if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u; |
| 50 | + r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});} |
| 51 | + else if(cc)h.w.jqmAddClose($(cc,h.w)); |
| 52 | + |
| 53 | + if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o); |
| 54 | + (c.onShow)?c.onShow(h):h.w.show();e(h);return F; |
| 55 | +}, |
| 56 | +close:function(s){var h=H[s];if(!h.a)return F;h.a=F; |
| 57 | + if(A[0]){A.pop();if(!A[0])L('unbind');} |
| 58 | + if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove(); |
| 59 | + if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F; |
| 60 | +}, |
| 61 | +params:{}}; |
| 62 | +var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false, |
| 63 | +i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}), |
| 64 | +e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);}, |
| 65 | +f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}}, |
| 66 | +L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);}, |
| 67 | +m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;}, |
| 68 | +hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() { |
| 69 | + if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});}; |
| 70 | +})(jQuery); |
\ No newline at end of file |
Property changes on: trunk/extensions/AjaxLogin/jqModal.js |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 71 | + native |
Index: trunk/extensions/AjaxLogin/AjaxLogin.css |
— | — | @@ -12,6 +12,7 @@ |
13 | 13 | #userloginRound .boxHeader { |
14 | 14 | padding: 3px 5px; |
15 | 15 | font-size: 12px; /* Jack: added this */ |
| 16 | + |
16 | 17 | } |
17 | 18 | |
18 | 19 | #userloginRound form { |
— | — | @@ -21,10 +22,36 @@ |
22 | 23 | } |
23 | 24 | |
24 | 25 | /* copied from monaco/css/root.css */ |
25 | | -.color1, .color1 a, .yui-panel .hd { |
| 26 | +.color1, .color1 a, .hd { |
26 | 27 | background-color: #36C; |
27 | 28 | color: white; |
28 | 29 | } |
29 | 30 | .color2 { |
30 | 31 | background-color: #F5F5F5; |
31 | 32 | } |
| 33 | + |
| 34 | +.jqmWindow { |
| 35 | + display: none; |
| 36 | + |
| 37 | + position: fixed; |
| 38 | + top: 30%; |
| 39 | + left: 60%; |
| 40 | + |
| 41 | + margin-left: -300px; |
| 42 | + |
| 43 | + background-color: #EEE; |
| 44 | + color: #333; |
| 45 | + border: 1px solid black; |
| 46 | +} |
| 47 | + |
| 48 | + |
| 49 | +.jqmOverlay { background-color: #000; } |
| 50 | + |
| 51 | +/* Fixed posistioning emulation for IE6 |
| 52 | + * Star selector used to hide definition from browsers other than IE6 |
| 53 | + * For valid CSS, use a conditional include instead */ |
| 54 | +* html .jqmWindow { |
| 55 | + position: absolute; |
| 56 | + top: expression((document.documentElement.scrollTop || document.body.scrollTop) + Math.round(17 * (document.documentElement.offsetHeight || document.body.clientHeight) / 100) + 'px'); |
| 57 | +} |
| 58 | + |
Index: trunk/extensions/AjaxLogin/AjaxLogin.js |
— | — | @@ -1,172 +1,163 @@ |
2 | | -/** |
3 | | - * JavaScript for AjaxLogin extension |
4 | | - * @todo FIXME: rewrite and document (see README) |
5 | | - * @author Inez Korczyński <korczynski(at)gmail(dot)com> |
6 | | - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
7 | | - */ |
| 2 | +(function($) { |
| 3 | +mediawiki = new Object; |
8 | 4 | |
9 | | -if( typeof wgEnableAjaxLogin != 'undefined' && wgEnableAjaxLogin ) { |
| 5 | +mediawiki.AjaxLogin = function() { |
| 6 | + this._loginPanel = null; |
| 7 | + this._loginForm = null; |
| 8 | +}; |
10 | 9 | |
11 | | - YAHOO.namespace("wikia.AjaxLogin"); |
| 10 | +mediawiki.AjaxLogin.prototype.initialize = function() { |
| 11 | + this._loginPanel = $("#userloginRound"); |
| 12 | + this._loginForm = $("#userajaxloginform"); |
| 13 | + if(this._loginPanel.length > 0) { |
| 14 | + this._loginPanel.jqm({modal : true, toTop : true}); |
| 15 | + var that = this; |
| 16 | + $("#pt-anonlogin, #pt-login").click( function(event) { |
| 17 | + event.preventDefault(); |
| 18 | + that.showLoginPanel(); |
| 19 | + }); |
| 20 | + $("#wpLoginattempt").click(function(event) { |
| 21 | + event.preventDefault(); |
| 22 | + that.postAjax("wpLoginattempt"); |
| 23 | + }); |
| 24 | + $("#wpMailmypassword").click(function(event) { |
| 25 | + event.preventDefault(); |
| 26 | + that.postAjax("wpMailmypassword"); |
| 27 | + }); |
| 28 | + $("#wpAjaxRegister").click(function(event) { |
| 29 | + that.doRegister(event); |
| 30 | + }); |
| 31 | + $("#wpClose").click(function(event) { |
| 32 | + that.doClose(event); |
| 33 | + }); |
| 34 | + } |
| 35 | +}; |
12 | 36 | |
13 | | - (function() { |
| 37 | +mediawiki.AjaxLogin.prototype.showLoginPanel = function() { |
| 38 | + this.refreshForm(); |
| 39 | + this._loginPanel.jqmShow(); |
| 40 | +}; |
14 | 41 | |
15 | | - var Dom = YAHOO.util.Dom; |
16 | | - var Event = YAHOO.util.Event; |
17 | | - var DDM = YAHOO.util.DragDropMgr; |
18 | | - |
19 | | - YAHOO.wikia.AjaxLogin = { |
20 | | - init: function() { |
21 | | - if( Dom.get( 'userloginRound' ) ) { |
22 | | - // Jack: changed to 'pt-anonlogin' from 'login' |
23 | | - Event.addListener( 'pt-anonlogin', 'click', YAHOO.wikia.AjaxLogin.showLoginPanel ); |
24 | | - } |
| 42 | +mediawiki.AjaxLogin.prototype.postAjax = function(action) { |
| 43 | + var actionURL = wgServer + wgScriptPath + '/api.php?action=ajaxlogin&format=json'; |
| 44 | + var dataString = this._loginForm.serialize(); |
| 45 | + dataString += "&" + action + "=" + action; |
| 46 | + this.disableForm(); |
| 47 | + var that = this; |
| 48 | + $.ajax({ |
| 49 | + type : "POST" , |
| 50 | + url : actionURL, |
| 51 | + dataType : "json", |
| 52 | + data : dataString, |
| 53 | + success : function(data) { |
| 54 | + that.requestSuccess(data); |
25 | 55 | }, |
26 | | - showLoginPanel: function( e ) { |
27 | | - // Prevent the default action for clicked element (probably A) |
28 | | - if( e ) { |
29 | | - YAHOO.util.Event.preventDefault(e); |
30 | | - } |
| 56 | + error : function(XMLHttpRequest, textStatus, errorThrown) |
| 57 | + { |
| 58 | + //TODO : add error handling here |
| 59 | + } |
| 60 | + }); |
| 61 | +}; |
31 | 62 | |
32 | | - if( YAHOO.lang.isUndefined( YAHOO.wikia.AjaxLogin.loginPanel ) ) { |
| 63 | +mediawiki.AjaxLogin.prototype.enableForm = function() { |
| 64 | + $("#wpName1").removeAttr("disabled"); |
| 65 | + $("#wpPassword1").removeAttr("disabled"); |
| 66 | + $("#wpLoginattempt").removeAttr("disabled"); |
| 67 | + $("#wpRemember").removeAttr("disabled"); |
| 68 | + $("#wpMailmypassword").removeAttr("disabled"); |
| 69 | + $("#wpPassword1").removeAttr("disabled"); |
| 70 | + $("#wpClose").removeAttr("disabled"); |
| 71 | +}; |
33 | 72 | |
34 | | - var keylistenerHandler = function(type, args, obj) { |
35 | | - YAHOO.wikia.AjaxLogin.loginPanel.hide(); |
36 | | - } |
| 73 | +mediawiki.AjaxLogin.prototype.disableForm = function() { |
| 74 | + $("#wpName1").attr("disabled", "disabled"); |
| 75 | + $("#wpPassword1").attr("disabled", "disabled"); |
| 76 | + $("#wpLoginattempt").attr("disabled", "disabled"); |
| 77 | + $("#wpRemember").attr("disabled", "disabled"); |
| 78 | + $("#wpMailmypassword").attr("disabled", "disabled"); |
| 79 | + $("#wpPassword1").attr("disabled", "disabled"); |
| 80 | + $("#wpClose").attr("disabled", "disabled"); |
| 81 | +}; |
37 | 82 | |
38 | | - YAHOO.wikia.AjaxLogin.keylistener = new YAHOO.util.KeyListener(document, { keys:[27] }, { fn:keylistenerHandler } ); |
| 83 | +mediawiki.AjaxLogin.prototype.displayReason = function(reason) { |
| 84 | + $("#wpError").html(reason + "<br /><br />").show(); |
| 85 | +}; |
39 | 86 | |
40 | | - //YAHOO.log("Initiate and display loginPanel", "info", "AjaxLogin.js"); |
41 | | - YAHOO.wikia.AjaxLogin.loginPanel = new YAHOO.widget.Panel('userloginRound', { |
42 | | - width: "auto", |
43 | | - modal: true, |
44 | | - constraintoviewport: true, |
45 | | - draggable: false, |
46 | | - fixedcenter: true, |
47 | | - underlay: "none", |
48 | | - visible: true, |
49 | | - keylisteners: YAHOO.wikia.AjaxLogin.keylistener |
50 | | - }); |
51 | | - Dom.setStyle('userloginRound', 'display', ''); |
52 | | - YAHOO.wikia.AjaxLogin.loginPanel.render(document.body); |
| 87 | +mediawiki.AjaxLogin.prototype.doRegister = function(event){ |
| 88 | + if($("#wpPreview").length > 0 && $("#wpLogin").length > 0) { |
| 89 | + if( typeof(ajaxLogin2) != 'undefined' && !confirm(ajaxLogin2)) { |
| 90 | + event.preventDefault(); |
| 91 | + } |
| 92 | + } |
| 93 | +}; |
53 | 94 | |
54 | | - // add submit event handler for login form |
55 | | - Event.addListener('userajaxloginform', 'submit', YAHOO.wikia.AjaxLogin.formSubmitHandler); |
56 | | - Event.addListener('wpAjaxRegister', 'click', YAHOO.wikia.AjaxLogin.ajaxRegisterConfirm); |
57 | | - } else { |
58 | | - //YAHOO.log("Display initiated loginPanel", "info", "AjaxLogin.js"); |
59 | | - YAHOO.wikia.AjaxLogin.loginPanel.show(); |
60 | | - } |
61 | | - if( Dom.get('wpName1') ) { |
62 | | - Dom.get('wpName1').focus(); |
63 | | - } |
64 | | - }, |
65 | | - formSubmitHandler: function( e ) { |
66 | | - // Prevent the default action for event (submit of form) |
67 | | - if( e ) { |
68 | | - YAHOO.util.Event.preventDefault(e); |
69 | | - } |
| 95 | +mediawiki.AjaxLogin.prototype.refreshForm = function() { |
| 96 | + $("#wpName1").val(""); |
| 97 | + $("#wpPassword1").val(""); |
| 98 | + $("#wpError").html(""); |
| 99 | + this.enableForm(); |
70 | 100 | |
71 | | - var ajaxLoginCallback = { |
72 | | - success: YAHOO.wikia.AjaxLogin.handleSuccess, |
73 | | - failure: YAHOO.wikia.AjaxLogin.handleFailure, |
74 | | - scope: YAHOO.wikia.AjaxLogin |
75 | | - }; |
| 101 | +}; |
76 | 102 | |
77 | | - YAHOO.util.Connect.setForm('userajaxloginform'); |
| 103 | +mediawiki.AjaxLogin.prototype.doClose = function(event){ |
| 104 | + this._loginPanel.jqmHide(); |
| 105 | +}; |
78 | 106 | |
79 | | - // Let's block login form (disable buttons and input boxes) |
80 | | - YAHOO.wikia.AjaxLogin.blockLoginForm(true); |
81 | | - |
82 | | - var actionURL = wgServer + wgScriptPath + '/api.php?action=ajaxlogin&format=json'; |
83 | | - var cObj = YAHOO.util.Connect.asyncRequest('POST', actionURL, ajaxLoginCallback); |
84 | | - }, |
85 | | - handleSuccess: function(o) { |
86 | | - var response = YAHOO.Tools.JSONParse(o.responseText); |
87 | | - var responseResult = response.ajaxlogin.result; |
88 | | - switch(responseResult) { |
89 | | - case 'Reset': |
90 | | - if( Dom.get( 'wpPreview' ) && Dom.get( 'wpLogin' ) ) { |
91 | | - if( typeof( ajaxLogin1 ) != 'undefined' && !confirm( ajaxLogin1 ) ) { |
92 | | - break; |
93 | | - } |
94 | | - } |
95 | | - Dom.get('userajaxloginform').action = wgServer + wgScriptPath + '/index.php?title=Special:Userlogin&action=submitlogin&type=login'; |
96 | | - Event.removeListener('userajaxloginform', 'submit', YAHOO.wikia.AjaxLogin.formSubmitHandler); |
97 | | - YAHOO.wikia.AjaxLogin.blockLoginForm(false); |
98 | | - Dom.get('userajaxloginform').submit(); |
99 | | - YAHOO.wikia.AjaxLogin.blockLoginForm(true); |
| 107 | +mediawiki.AjaxLogin.prototype.requestSuccess = function(data) { |
| 108 | + var responseResult = data.ajaxlogin.result; |
| 109 | + switch(responseResult) { |
| 110 | + case "Reset": |
| 111 | + if($("#wpPreview").length > 0 && $("#wpLogin").length > 0) { |
| 112 | + if(typeof(ajaxLogin1) != 'undefined' && !confirm(ajaxLogin1)) { |
100 | 113 | break; |
101 | | - case 'Success': |
102 | | - // Jack: Special:RequestWiki probably doesn't exist outside Wikia sites... |
103 | | - /*if( wgCanonicalNamespace == 'Special' && wgCanonicalSpecialPageName == 'RequestWiki' ) { |
104 | | - Event.removeListener('pSubmit', 'click', YAHOO.wikia.AjaxLogin.showLoginPanel); |
105 | | - Dom.get('pSubmit').click(); |
106 | | - } else*/ if( Dom.get('wpPreview') && Dom.get('wpLogin') ) { |
107 | | - if( Dom.get('wikiDiff') && (Dom.get('wikiDiff').childNodes.length > 0) ) { |
108 | | - Dom.get('wpDiff').click(); |
109 | | - } else { |
110 | | - if( Dom.get('wikiPreview') && Dom.get('wikiPreview').childNodes.length == 0 ) { |
111 | | - Dom.get('wpLogin').value = 1; |
112 | | - } |
113 | | - Dom.get('wpPreview').click(); |
114 | | - } |
115 | | - } else { |
116 | | - if( wgCanonicalSpecialPageName == 'Userlogout' ) { |
117 | | - window.location.href = wgServer + wgScriptPath; |
118 | | - } else { |
119 | | - window.location.reload(true); |
120 | | - } |
121 | | - } |
122 | | - break; |
123 | | - case 'NotExists': |
124 | | - this.blockLoginForm(false); |
125 | | - Dom.get('wpName1').value = ''; |
126 | | - Dom.get('wpPassword1').value = ''; |
127 | | - Dom.get('wpName1').focus(); |
128 | | - case 'WrongPass': |
129 | | - this.blockLoginForm(false); |
130 | | - Dom.get('wpPassword1').value = ''; |
131 | | - Dom.get('wpPassword1').focus(); |
132 | | - default: |
133 | | - this.blockLoginForm(false); |
134 | | - this.displayReason(response.ajaxlogin.text); |
135 | | - break; |
| 114 | + } |
136 | 115 | } |
137 | | - }, |
138 | | - handleFailure: function() { |
139 | | - //YAHOO.log("YAHOO.wikia.AjaxLogin.handleFailure was called", "error", "AjaxLogin.js"); |
140 | | - }, |
141 | | - displayReason: function(reason) { |
142 | | - Dom.setStyle('wpError', 'display', ''); |
143 | | - Dom.get('wpError').innerHTML = reason + '<br /><br />'; |
144 | | - }, |
145 | | - blockLoginForm: function(block) { |
146 | | - if( !YAHOO.lang.isBoolean(block) ) { |
147 | | - //YAHOO.log("YAHOO.wikia.AjaxLogin.blockLoginForm was called with parameter which is not boolean", "error", "AjaxLogin.js"); |
148 | | - return; |
149 | | - } |
150 | | - if( Dom.get('wpName1') ) |
151 | | - Dom.get('wpName1').disabled = block; |
152 | | - if( Dom.get('wpPassword1') ) |
153 | | - Dom.get('wpPassword1').disabled = block; |
154 | | - if( Dom.get('wpLoginattempt') ) |
155 | | - Dom.get('wpLoginattempt').disabled = block; |
156 | | - if( Dom.get('wpRemember') ) |
157 | | - Dom.get('wpRemember').disabled = block; |
158 | | - if( Dom.get('wpMailmypassword') ) |
159 | | - Dom.get('wpMailmypassword').disabled = block; |
160 | | - }, |
161 | | - ajaxRegisterConfirm: function( e ) { |
162 | | - if( Dom.get( 'wpPreview' ) && Dom.get( 'wpLogin' ) ) { |
163 | | - if( typeof( ajaxLogin2 ) != 'undefined' && !confirm( ajaxLogin2 ) ) { |
164 | | - YAHOO.util.Event.preventDefault( e ); |
| 116 | + this._loginForm.attr("action", wgServer + wgScriptPath + "/index.php?title=Special:Userlogin&action=submitlogin&type=login"); |
| 117 | + this._loginForm.unbind("submit"); |
| 118 | + this.disableForm(); |
| 119 | + this._loginForm.submit(); |
| 120 | + this.enableForm(); |
| 121 | + break; |
| 122 | + case "Success": |
| 123 | + if($("#wpPreview").length > 0 && $("#wpLogin").length > 0) { |
| 124 | + if($("#wikiDiff").length > 0 && ($("#wikiDiff").children.length > 0) ) { |
| 125 | + $("#wpDiff").click(); |
| 126 | + } else { |
| 127 | + if( $("#wikiPreview") && $("#wikiPreview").children.length == 0 ) { |
| 128 | + $("#wpLogin").val(1); |
| 129 | + } |
| 130 | + $("#wpPreview").click(); |
165 | 131 | } |
| 132 | + } else { |
| 133 | + if( wgCanonicalSpecialPageName == 'Userlogout' ) { |
| 134 | + window.location.href = wgServer + wgScriptPath; |
| 135 | + } else { |
| 136 | + window.location.reload(true); |
| 137 | + } |
166 | 138 | } |
167 | | - } |
| 139 | + break; |
| 140 | + case "NotExists": |
| 141 | + this.enableForm(); |
| 142 | + $("#wpName1").value = ""; |
| 143 | + $("#wpPassword1").value = ""; |
| 144 | + $("#wpName1").focus(); |
| 145 | + case "WrongPass": |
| 146 | + this.enableForm(); |
| 147 | + $("#wpPassword1").val(""); |
| 148 | + $("#wpPassword1").focus(); |
| 149 | + default: |
| 150 | + this.enableForm(); |
| 151 | + this.displayReason(data.ajaxlogin.text); |
| 152 | + break; |
168 | 153 | } |
| 154 | +}; |
169 | 155 | |
170 | | - Event.onDOMReady(YAHOO.wikia.AjaxLogin.init, YAHOO.wikia.AjaxLogin, true); |
| 156 | +$(document).ready( function() { |
| 157 | + if( typeof wgEnableAjaxLogin != 'undefined' && wgEnableAjaxLogin ) |
| 158 | + { |
| 159 | + var ajaxLogin = new mediawiki.AjaxLogin(); |
| 160 | + ajaxLogin.initialize(); |
| 161 | + } |
| 162 | +}); |
171 | 163 | |
172 | | - })(); |
173 | | -} |
\ No newline at end of file |
| 164 | +})(jQuery); |
Index: trunk/extensions/AjaxLogin/jquery-1.3.2.min.js |
Property changes on: trunk/extensions/AjaxLogin/jquery-1.3.2.min.js |
___________________________________________________________________ |
Name: svn:eol-style |
174 | 165 | + native |
Index: trunk/extensions/AjaxLogin/ApiAjaxLogin.php |
— | — | @@ -12,12 +12,12 @@ |
13 | 13 | } |
14 | 14 | |
15 | 15 | class ApiAjaxLogin extends ApiBase { |
16 | | - |
17 | 16 | public function __construct( $main, $action ) { |
18 | 17 | parent::__construct( $main, $action, 'wp' ); |
19 | 18 | } |
20 | 19 | |
21 | 20 | public function execute() { |
| 21 | + session_start(); |
22 | 22 | $Name = $Password = $Remember = $Loginattempt = $Mailmypassword = null; |
23 | 23 | extract( $this->extractRequestParams() ); |
24 | 24 | |
— | — | @@ -63,6 +63,7 @@ |
64 | 64 | break; |
65 | 65 | case LoginForm::NOT_EXISTS: |
66 | 66 | $result['result'] = 'NotExists'; |
| 67 | + wfLoadExtensionMessages( 'AjaxLogin' ); |
67 | 68 | $result['text'] = wfMsg( 'nosuchuser', htmlspecialchars( $Name ) ); |
68 | 69 | break; |
69 | 70 | case LoginForm::WRONG_PASS: |
— | — | @@ -106,6 +107,7 @@ |
107 | 108 | $result['text'] = wfMsg( 'noname' ); |
108 | 109 | } else if ( 0 == $u->getID() ) { |
109 | 110 | $result['result'] = 'nosuchuser'; |
| 111 | + wfLoadExtensionMessages( 'AjaxLogin' ); |
110 | 112 | $result['text'] = wfMsg( 'nosuchuser', $u->getName() ); |
111 | 113 | } else if ( $u->isPasswordReminderThrottled() ) { |
112 | 114 | global $wgPasswordReminderResendTime; |
— | — | @@ -136,10 +138,11 @@ |
137 | 139 | 'Remember' => null, |
138 | 140 | 'Loginattempt' => null, |
139 | 141 | 'Mailmypassword' => null |
| 142 | + |
140 | 143 | ); |
141 | 144 | } |
142 | 145 | |
143 | 146 | public function getVersion() { |
144 | | - return __CLASS__ . ': $Id: ApiLogin.php 17065 2006-10-17 02:11:29Z yurik $'; |
| 147 | + return __CLASS__ . ': $Id$'; |
145 | 148 | } |
146 | | -} |
\ No newline at end of file |
| 149 | +} |
Property changes on: trunk/extensions/AjaxLogin/ApiAjaxLogin.php |
___________________________________________________________________ |
Name: svn:keywords |
147 | 150 | + Id |
Index: trunk/extensions/AjaxLogin/README |
— | — | @@ -7,15 +7,14 @@ |
8 | 8 | |
9 | 9 | Some code hacks were written by Jack Phoenix <jack@countervandalism.net>. |
10 | 10 | |
| 11 | +Replaced YUI with JQuery - Chamindu Munasinghe <chamindu@calcey.com>. |
| 12 | + |
11 | 13 | ==License== |
12 | 14 | GNU General Public License 2.0 or later |
13 | 15 | |
14 | 16 | ==Dependency== |
15 | | -Yahoo! User Interface Library (YUI); see function AjaxLoginJS in AjaxLogin.php. |
16 | | -AjaxLogin calls two YUI .js files which are hosted on Yahoo!'s servers, two YUI .css files, which also are hosted |
17 | | -on Yahoo!'s servers, two of its own .js files and its only .css file. |
18 | 17 | |
19 | | -Please note that AjaxLogin does not work with YUI 2.7.0, hence why it's using 2.6.0's JS files rather than using 2.7.0. |
| 18 | +JQuery |
20 | 19 | |
21 | 20 | ==Manual modifications== |
22 | 21 | You will need to modify one core MediaWiki file, includes/EditPage.php, if you want users to be able to log in with AjaxLogin |