- //Defocus after input finished
- $(".stop-focus").on("input", function(){
- if($(this).val().length == $(this).prop("maxlength")){
- $(this).blur();
- var target=$($(this).data("ref"));
- $("html, body").animate({
- scrollTop: $(target).offset().top
- }, 1000);
+ //Parse app info from server
+ $.get("https://code.agnibho.com/pdosage/info.json", function(data){
+ var vCurr=VERSION.split(".").map(Number);
+ var vLtst=data.latest.split(".").map(Number);
+
+ if(isBiggerThan(data.latest, VERSION)){
+ $("#notify").slideDown();
+ $("#notify").width($(".container").width()-20);
+ $("#notify-text").text("A new version of PDosage is available.");
+ if(document.URL.indexOf("http://")==-1 && document.URL.indexOf("https://")==-1){
+ if(/(android)/i.test(navigator.userAgent)){
+ $("#notify-link").attr("href", data.apk);
+ $("#notify-link").text("Download");
+ }
+ else{
+ $("#notify-link").attr("href", data.url);
+ $("#notify-link").text("Load");
+ }
+ }
+ else{
+ $("#notify-link").attr("href", data.url);
+ $("#notify-link").text("Load");
+ }
+ }
+
+ try{
+ if(data.data.latest>JSON.parse(localStorage.getItem("pdosage_data")).version){
+ $.get(data.data.src, function(d){
+ localStorage.setItem("pdosage_data", JSON.stringify(d));
+ });
+ }