| [ Index ] |
PHP Cross Reference of Wordpress 2.9.1 |
[Summary view] [Print] [Text view]
1 2 var wpGears = { 3 4 createStore : function() { 5 if ( 'undefined' == typeof google || ! google.gears ) return; 6 7 if ( 'undefined' == typeof localServer ) 8 localServer = google.gears.factory.create("beta.localserver"); 9 10 store = localServer.createManagedStore(this.storeName()); 11 store.manifestUrl = "gears-manifest.php"; 12 store.checkForUpdate(); 13 this.message(3); 14 }, 15 16 getPermission : function() { 17 var perm = true; 18 19 if ( 'undefined' != typeof google && google.gears ) { 20 if ( ! google.gears.factory.hasPermission ) 21 perm = google.gears.factory.getPermission( 'WordPress', 'images/logo.gif' ); 22 23 if ( perm ) 24 try { this.createStore(); } catch(e) { this.message(); } // silence if canceled 25 else 26 this.message(4); 27 } 28 }, 29 30 storeName : function() { 31 var name, host = window.location.host; 32 33 if ( host.match(/[^a-z0-9._-]/i) ) 34 host = encodeURIComponent(host); 35 36 name = window.location.protocol + host; 37 name = name.replace(/[^a-z0-9._-]+/gi, '_'); 38 name = 'wp_' + name.substring(0, 60); // max length of name is 64 chars 39 40 return name; 41 }, 42 43 message : function(show) { 44 var t = this, msg1 = t.I('gears-msg1'), msg2 = t.I('gears-msg2'), msg3 = t.I('gears-msg3'), msg4 = t.I('gears-msg4'), num = t.I('gears-upd-number'), wait = t.I('gears-wait'); 45 46 if ( ! msg1 ) return; 47 48 if ( 'undefined' != typeof google && google.gears ) { 49 if ( show && show == 4 ) { 50 msg1.style.display = msg2.style.display = msg3.style.display = 'none'; 51 msg4.style.display = 'block'; 52 } else if ( google.gears.factory.hasPermission ) { 53 msg1.style.display = msg2.style.display = msg4.style.display = 'none'; 54 msg3.style.display = 'block'; 55 56 if ( 'undefined' == typeof store ) 57 t.createStore(); 58 59 store.oncomplete = function(){wait.innerHTML = (' ' + wpGearsL10n.updateCompleted);}; 60 store.onerror = function(){wait.innerHTML = (' ' + wpGearsL10n.error + ' ' + store.lastErrorMessage);}; 61 store.onprogress = function(e){if(num) num.innerHTML = (' ' + e.filesComplete + ' / ' + e.filesTotal);}; 62 } else { 63 msg1.style.display = msg3.style.display = msg4.style.display = 'none'; 64 msg2.style.display = 'block'; 65 } 66 } 67 }, 68 69 I : function(id) { 70 return document.getElementById(id); 71 } 72 }; 73 74 (function() { 75 if ( 'undefined' != typeof google && google.gears ) return; 76 77 var gf = false; 78 if ( 'undefined' != typeof GearsFactory ) { 79 gf = new GearsFactory(); 80 } else { 81 try { 82 gf = new ActiveXObject('Gears.Factory'); 83 if ( factory.getBuildInfo().indexOf('ie_mobile') != -1 ) 84 gf.privateSetGlobalObject(this); 85 } catch (e) { 86 if ( ( 'undefined' != typeof navigator.mimeTypes ) && navigator.mimeTypes['application/x-googlegears'] ) { 87 gf = document.createElement("object"); 88 gf.style.display = "none"; 89 gf.width = 0; 90 gf.height = 0; 91 gf.type = "application/x-googlegears"; 92 document.documentElement.appendChild(gf); 93 } 94 } 95 } 96 97 if ( ! gf ) return; 98 if ( 'undefined' == typeof google ) google = {}; 99 if ( ! google.gears ) google.gears = { factory : gf }; 100 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Jan 8 00:19:48 2010 | Cross-referenced by PHPXref 0.7 |