4 createStore : function() {
5 if ( 'undefined' == typeof google || ! google.gears ) return;
7 if ( 'undefined' == typeof localServer )
8 localServer = google.gears.factory.create("beta.localserver");
10 store = localServer.createManagedStore(this.storeName());
11 store.manifestUrl = "gears-manifest.php";
12 store.checkForUpdate();
16 getPermission : function() {
17 if ( 'undefined' != typeof google && google.gears ) {
18 if ( ! google.gears.factory.hasPermission )
19 google.gears.factory.getPermission( 'WordPress', 'images/logo.gif' );
23 } catch(e) {} // silence if canceled
27 storeName : function() {
28 var name = window.location.protocol + window.location.host;
30 name = name.replace(/[\/\\:*"?<>|;,]+/g, '_'); // gears beta doesn't allow certain chars in the store name
31 name = 'wp_' + name.substring(0, 60); // max length of name is 64 chars
36 message : function(show) {
37 var t = this, msg1 = t.I('gears-msg1'), msg2 = t.I('gears-msg2'), msg3 = t.I('gears-msg3'), num = t.I('gears-upd-number'), wait = t.I('gears-wait');
41 if ( 'undefined' != typeof google && google.gears ) {
42 if ( google.gears.factory.hasPermission ) {
43 msg1.style.display = msg2.style.display = 'none';
44 msg3.style.display = 'block';
46 if ( 'undefined' == typeof store )
49 store.oncomplete = function(){wait.innerHTML = (' ' + wpGearsL10n.updateCompleted);};
50 store.onerror = function(){wait.innerHTML = (' ' + wpGearsL10n.error + ' ' + store.lastErrorMessage);};
51 store.onprogress = function(e){if(num) num.innerHTML = (' ' + e.filesComplete + ' / ' + e.filesTotal);};
53 msg1.style.display = msg3.style.display = 'none';
54 msg2.style.display = 'block';
58 if ( show ) t.I('gears-info-box').style.display = 'block';
62 return document.getElementById(id);
67 if ( 'undefined' != typeof google && google.gears ) return;
70 if ( 'undefined' != typeof GearsFactory ) {
71 gf = new GearsFactory();
74 gf = new ActiveXObject('Gears.Factory');
75 if ( factory.getBuildInfo().indexOf('ie_mobile') != -1 )
76 gf.privateSetGlobalObject(this);
78 if ( ( 'undefined' != typeof navigator.mimeTypes ) && navigator.mimeTypes['application/x-googlegears'] ) {
79 gf = document.createElement("object");
80 gf.style.display = "none";
83 gf.type = "application/x-googlegears";
84 document.documentElement.appendChild(gf);
90 if ( 'undefined' == typeof google ) google = {};
91 if ( ! google.gears ) google.gears = { factory : gf };