var refreshIntervalId = null; // Prefer same-origin relative paths so HTTPS doesn't break due to mixed-content / upgrade rules. var imgurl = "img/"; function getApiUrl() { // Use scheme-relative URL so it matches http/https of the current page. // NOTE: if the API does not support https, consider proxying it via Apache and pointing to a same-origin endpoint. return "//api.martn.ncue.net/dreamgirl.ncue"; } function getRandomIndex(n) { var arr = new Array(); var temp; var rnum; for(var i=0; i"; text += " girl" + (i+1) + ""; text += " "; text += "
"; text += ""; } text += ""; $("#thumbs-list").html(text); initGallery(); } function tryLoadFromLocalListApi() { return $.ajax({ url: 'api/list_images.php', type: 'GET', dataType: 'json', cache: false, timeout: 8000 }); } function fallbackToLocalManifest() { if (window.DREAMGIRL_IMAGES && window.DREAMGIRL_IMAGES.length) { buildThumbsFromList(window.DREAMGIRL_IMAGES); return true; } // Minimal fallback if manifest is missing for some reason buildThumbsFromList(['0.jpg','1.jpg','2.jpg','3.jpg','20.jpg','24.jpg','25.jpg','26.jpg','28.jpg','36.jpg','66.jpg']); return true; } // Prefer same-origin dynamic list (so newly uploaded images appear on refresh). tryLoadFromLocalListApi() .done(function(resp) { if (resp && resp.ok && resp.images && resp.images.length) { buildThumbsFromList(resp.images); } else { fallbackToLocalManifest(); } }) .fail(function() { // If local list API is unavailable, try remote JSONP API, then fall back to static manifest. $.ajax({ url : getApiUrl(), type: 'GET', data : "id=user", dataType : "jsonp", jsonp : "callback", cache : false, timeout: 15000, success: function(data) { try { var filelist = data && data.filelist ? data.filelist : null; if (!filelist || !filelist.length) return fallbackToLocalManifest(); var names = []; for (var i=0; i"); }, 3000); */ $("#toggle").html("stop"); } }