1 line
1.8 KiB
JavaScript
1 line
1.8 KiB
JavaScript
(function(){var a;a=angular.module("llngConfDiff",["ui.tree","ui.bootstrap","llApp","ngCookies"]);a.controller("DiffCtrl",["$scope","$http","$q","$translator","$location",function(e,i,d,c,h){var b,g,f;e.links=links;e.menulinks=menulinks;e.staticPrefix=staticPrefix;e.scriptname=scriptname;e.availableLanguages=availableLanguages;e.waiting=true;e.showM=false;e.cfg=[];e.translateTitle=function(j){return c.translateField(j,"title")};e.translateP=c.translateP;e.translate=c.translate;e.menuClick=function(j){if(j.popup){window.open(j.popup)}else{if(!j.action){j.action=j.title}switch(typeof j.action){case"function":j.action(e.currentNode,e);break;case"string":e[j.action]();break;default:console.log(typeof j.action)}}return e.showM=false};e.getLanguage=function(j){e.lang=j;e.init();return e.showM=false};b=function(j,l){var k;k=d.defer();if((e.cfg[j]==null)||e.cfg[j]!==l){i.get(""+confPrefix+l).then(function(m){var n;e.cfg[j]=m.data;n=new Date(m.data.cfgDate*1000);e.cfg[j].date=n.toLocaleString();console.log("Metadatas of cfg "+l+" loaded");return k.resolve("OK")},function(m){console.log(m);return k.reject("NOK")})}else{k.resolve()}return k.promise};g=function(){var j;e.message=null;j=d.defer();return i.get(scriptname+"/diff/"+e.cfg[0].cfgNum+"/"+e.cfg[1].cfgNum).then(function(k){e.data=k.data;return e.waiting=false},function(k){return e.message=(e.translate("error"))+" : "+k.statusLine})};f=function(k,j,l){var m;m=j.match(new RegExp("#/(latest|[0-9]+)(?:/(latest|[0-9]+))?$"));if(m===null){h.path("/latest")}else{e.waiting=true;d.all([c.init(e.lang),b(0,m[1]),m[2]!=null?b(1,m[2]):void 0]).then(function(){if(m[2]!=null){return g()}else{if(e.cfg[0].prev){return b(1,e.cfg[0].prev).then(function(){return g()})}else{e.message=e.translate("noDatas");return e.waiting=false}}})}return true};return e.$on("$locationChangeSuccess",f)}])}).call(this); |