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