Changeset 12473 for extensions/piwigo_mobile/ios/www/js
- Timestamp:
- Oct 17, 2011, 8:27:39 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/piwigo_mobile/ios/www/js/app.js
r12411 r12473 4 4 var backPage; 5 5 var conf = new Object; 6 var selectedCat = '0'; 7 var logged = false; 6 var selectedCat = null; 8 7 var lastImageURL; 9 8 var pwg_token; … … 14 13 var OSCode = 'IPH'; 15 14 16 // Wait for PhoneGap to connect with the device17 document.addEventListener("deviceready",onDeviceReady,false);18 19 // PhoneGap is ready to be used!20 function onDeviceReady() {21 22 pictureSource=navigator.camera.PictureSourceType;23 destinationType=navigator.camera.DestinationType;24 25 var reg = /(iphone|ipad|ipod)/i;26 if (!reg.test(device.platform)) OSCode = 'AND';27 28 if (!checkDeviceConnection ()) {29 message("Error", "Please check your internet connection", '#config');30 }31 }32 33 34 15 $(document).ready( function () { 16 17 $(document).bind("deviceready", function() { 18 19 pictureSource=navigator.camera.PictureSourceType; 20 destinationType=navigator.camera.DestinationType; 21 22 var reg = /(iphone|ipad|ipod)/i; 23 if (!reg.test(device.platform)) OSCode = 'AND'; 24 25 if (!checkDeviceConnection ()) { 26 message("Error", "Please check your internet connection", '#config'); 27 } 28 29 $(document).bind("resume", pwgLogin); 30 }); 35 31 36 32 // Init 37 33 loadSettings(); 38 language = navigator.language.split("-"); 39 loadLanguage(language[0]); 34 loadLanguage(navigator.language); 40 35 41 36 // Page events … … 118 113 }, 119 114 error: function() { 120 loadLanguage('en ');115 loadLanguage('en-us'); 121 116 } 122 117 }); … … 169 164 170 165 // Log only if connection parameters have changed 171 if (conf.url != old_conf.url || conf.username != old_conf.username || conf.password != old_conf.password || !logged) {172 selectedCat = '0';166 if (conf.url != old_conf.url || conf.username != old_conf.username || conf.password != old_conf.password || selectedCat == null) { 167 selectedCat = null; 173 168 pwgLogin(); 174 169 } else { … … 193 188 194 189 195 function pwgLogin( ) {190 function pwgLogin(callback) { 196 191 197 192 $.mobile.loadingMessage = l10n("Loging"); … … 208 203 dataType: "json", 209 204 success: function(data) { 205 $.mobile.hidePageLoadingMsg(); 210 206 if (data.stat == "ok") { 211 logged = true;212 $.mobile.changePage('#album');213 207 getPwgToken(); 214 getCategories(); 208 if (selectedCat == null) { 209 selectedCat = '0'; 210 getCategories(); 211 $.mobile.changePage('#album'); 212 } 215 213 } else { 216 $.mobile.hidePageLoadingMsg();217 logged = false;218 214 $.mobile.changePage('#config', { transition: "none" }); 219 215 message("Error", data.message, '#config'); … … 222 218 error: function(data) { 223 219 $.mobile.hidePageLoadingMsg(); 224 logged = false;225 220 $.mobile.changePage('#config', { transition: "none" }); 226 221 if (!checkDeviceConnection ()) { … … 327 322 } 328 323 324 $.mobile.loadingMessage = l10n("Album creation"); 325 $.mobile.showPageLoadingMsg(); 326 329 327 $.ajax({ 330 328 type: "POST", … … 338 336 async: false, 339 337 success: function(data) { 338 $.mobile.hidePageLoadingMsg(); 340 339 if (data.stat == "ok") { 341 340 selectedCat = data['result']['id']; … … 347 346 }, 348 347 error: function(data) { 348 $.mobile.hidePageLoadingMsg(); 349 349 message("Error", "An error has occured", '#album', data.status, data.statusText); 350 350 } … … 487 487 function removeAllPhotos() { 488 488 489 if (queue.length == 0) return; 490 489 491 for (i in queue) { 490 492 removePhoto(queue[i][0]);
Note: See TracChangeset
for help on using the changeset viewer.