1. Chun-Ping Chang
  2. GaiaSup static page

Commits

Chun-Ping Chang  committed cf617c6

compress manage.min.js by YUI compressor

  • Participants
  • Parent commits c8ac7cb
  • Branches production

Comments (0)

Files changed (1)

File assets/js/custom/manage.min.js

View file
-$(document).ready(function(){function h(){$.ajax({type:"GET",url:"/query/user/self",dataType:"json",cache:!1,success:function(a){$("span.spnUserID").text(a[0].id);(new jsSHA(a[0])).getHash("SHA-1","HEX");c=JSON.stringify(a[0].apikey);$.ajax({type:"POST",url:"/query/apikeys",dataType:"json",cache:!1,data:c,success:function(a){d=a[0];c=$.parseJSON(c);$("div.div_table").empty().append("<div class='div_table_row'> \n\t <div class='div_table_col_projname'><strong>Project Name</strong></div> \n\t <div class='div_table_col_appkeys'><strong>API Keys</strong></div> \n\t <div class='div_table_col_manage'><strong>Manage</strong></div></div>");
-for(key in c)$("div.div_table").append("<div id='"+c[key]+"' class='div_table_row'> \n <div class='div_table_col_projname'><span>"+d[c[key]].name+"</span></div> \n <div class='div_table_col_appkeys'><span>"+c[key]+"</span></div> \n <div class='div_table_col_manage'><span> <a class='btn btn-primary btn-small modify' href='#'> <i class='icon-pencil icon-white'></i> </a> </span> <span> <a class='btn btn-success btn-small regen' href='#'> <i class='icon-repeat icon-white'></i> </a> </span> <span> <a class='btn btn-danger btn-small del' href='#'> <i class='icon-remove icon-white'></i> </a> </span></div></div>")}})},
-error:function(){$("div.div_table").empty().append("<div class='center'><h3>Load API List Failed!</h3></div>")}})}var f=void 0,b=void 0,e={},c=[],d=void 0,j=void 0,l=void 0,k=void 0,m=void 0,g=0;$("#modalAddMod").bind("show",function(){switch(f){case "ADD":targetUrl="/create/apikey";break;case "MODIFY":targetUrl="/store/apikey/"+b}$("#btnSave").click(function(){var a={};a.name=$("#txtProjName").val();a.link=$("#txtWebLink").val();a.desc=$("#txtDesc").val();$.ajax({type:"POST",url:targetUrl,dataType:"json",
-cache:!0,data:JSON.stringify(a),success:function(){switch(f){case "ADD":h();break;case "MODIFY":h()}}});$("#modalAddMod").modal("hide")});$("#btnCancel").click(function(){$("#modalAddMod").modal("hide")})});$("#modalAddMod").bind("hide",function(){$("#modalAddMod a.btn").unbind()});$("#modalAddMod").modal({backdrop:!0,keyboard:!1,show:!1});$("#modalDelAlert").bind("show",function(){$("#delYes").click(function(){$.ajax({type:"GET",url:"/delete/apikey/"+b,dataType:"json",cache:!1,success:function(){e.fadeOut()}});
-$("#modalDelAlert").modal("hide")});$("#delNo").click(function(){$("#modalDelAlert").modal("hide")})});$("#modalDelAlert").bind("hide",function(){$("#modalDelAlert a.btn").unbind()});$("#modalDelAlert").modal({backdrop:!0,keyboard:!0,show:!1});$("#modalRegenAlert").bind("show",function(){$("#regenYes").click(function(){$.ajax({type:"GET",url:"/regen/apikey/"+b,dataType:"json",success:function(a){0===g&&(c[j]=a[0],d[a[0]]=m,delete d[l],e.attr("id",c[j]),b=e.attr("id"),k.text(a[0]),g+=1)},error:function(){k.text("Can not re-generate API key.")}});
-g=0;$("#modalRegenAlert").modal("hide")});$("#regenNo").click(function(){$("#modalRegenAlert").modal("hide")})});$("#modalDelAlert").bind("hide",function(){$("#modalDelAlert a.btn").unbind()});$("#modalDelAlert").modal({backdrop:!0,keyboard:!0,show:!1});h();$(".add").on("click",function(a){a.preventDefault();$("#modalAct").text("Add");f="ADD";$("#frmAddModify").find(":input").each(function(){switch(this.type){case "password":case "select-multiple":case "select-one":case "text":case "textarea":$(this).val("");
-break;case "checkbox":case "radio":this.checked=!1}});$("#modalAddMod").modal()});$("div.div_table").on("click","a.del",function(a){a.preventDefault();b=$(this).parent().parent().parent().attr("id");e=$(this).parent().parent().parent();$("#spnProjName").text(d[b].name);$("#modalDelAlert").modal()});$("div.div_table").on("click","a.modify",function(a){a.preventDefault();$("#modalAct").text("Modify");f="MODIFY";b=$(this).parent().parent().parent().attr("id");$("#txtProjName").val(d[b].name);$("#txtWebLink").val(d[b].link);
-$("#txtDesc").val(d[b].desc);$("#modalAddMod").modal()});$("div.div_table").on("click","a.regen",function(a){a.preventDefault();j=$.inArray(b,c);l=b=$(this).parent().parent().parent().attr("id");e=$(this).parent().parent().parent();k=$(this).parent().parent().parent().children(".div_table_col_appkeys").children("span");m=d[b];$("#modalRegenAlert").modal()})});
+$(document).ready(function(){function p(){$.ajax({type:"GET",url:"/query/user/self",dataType:"json",cache:!1,success:function(b){$("span.spnUserID").text(b[0].id);(new jsSHA(b[0])).getHash("SHA-1","HEX");u=JSON.stringify(b[0].apikey);$.ajax({type:"POST",url:"/query/apikeys",dataType:"json",cache:!1,data:u,success:function(c){t=c[0];u=$.parseJSON(u);$("div.div_table").empty().append("<div class='div_table_row'> \n\t <div class='div_table_col_projname'><strong>Project Name</strong></div> \n\t <div class='div_table_col_appkeys'><strong>API Keys</strong></div> \n\t <div class='div_table_col_manage'><strong>Manage</strong></div></div>");for(key in u){$("div.div_table").append("<div id='"+u[key]+"' class='div_table_row'> \n <div class='div_table_col_projname'><span>"+t[u[key]].name+"</span></div> \n <div class='div_table_col_appkeys'><span>"+u[key]+"</span></div> \n <div class='div_table_col_manage'><span> <a class='btn btn-primary btn-small modify' href='#'> <i class='icon-pencil icon-white'></i> </a> </span> <span> <a class='btn btn-success btn-small regen' href='#'> <i class='icon-repeat icon-white'></i> </a> </span> <span> <a class='btn btn-danger btn-small del' href='#'> <i class='icon-remove icon-white'></i> </a> </span></div></div>")}}})},error:function(){$("div.div_table").empty().append("<div class='center'><h3>Load API List Failed!</h3></div>")}})}var r=void 0,v=void 0,s={},u=[],t=void 0,o=void 0,i=void 0,n=void 0,a=void 0,q=0;$("#modalAddMod").bind("show",function(){switch(r){case"ADD":targetUrl="/create/apikey";break;case"MODIFY":targetUrl="/store/apikey/"+v}$("#btnSave").click(function(){var b={};b.name=$("#txtProjName").val();b.link=$("#txtWebLink").val();b.desc=$("#txtDesc").val();$.ajax({type:"POST",url:targetUrl,dataType:"json",cache:!0,data:JSON.stringify(b),success:function(){switch(r){case"ADD":p();break;case"MODIFY":p()}}});$("#modalAddMod").modal("hide")});$("#btnCancel").click(function(){$("#modalAddMod").modal("hide")})});$("#modalAddMod").bind("hide",function(){$("#modalAddMod a.btn").unbind()});$("#modalAddMod").modal({backdrop:!0,keyboard:!1,show:!1});$("#modalDelAlert").bind("show",function(){$("#delYes").click(function(){$.ajax({type:"GET",url:"/delete/apikey/"+v,dataType:"json",cache:!1,success:function(){s.fadeOut()}});$("#modalDelAlert").modal("hide")});$("#delNo").click(function(){$("#modalDelAlert").modal("hide")})});$("#modalDelAlert").bind("hide",function(){$("#modalDelAlert a.btn").unbind()});$("#modalDelAlert").modal({backdrop:!0,keyboard:!0,show:!1});$("#modalRegenAlert").bind("show",function(){$("#regenYes").click(function(){$.ajax({type:"GET",url:"/regen/apikey/"+v,dataType:"json",success:function(b){0===q&&(u[o]=b[0],t[b[0]]=a,delete t[i],s.attr("id",u[o]),v=s.attr("id"),n.text(b[0]),q+=1)},error:function(){n.text("Can not re-generate API key.")}});q=0;$("#modalRegenAlert").modal("hide")});$("#regenNo").click(function(){$("#modalRegenAlert").modal("hide")})});$("#modalDelAlert").bind("hide",function(){$("#modalDelAlert a.btn").unbind()});$("#modalDelAlert").modal({backdrop:!0,keyboard:!0,show:!1});p();$(".add").on("click",function(b){b.preventDefault();$("#modalAct").text("Add");r="ADD";$("#frmAddModify").find(":input").each(function(){switch(this.type){case"password":case"select-multiple":case"select-one":case"text":case"textarea":$(this).val("");break;case"checkbox":case"radio":this.checked=!1}});$("#modalAddMod").modal()});$("div.div_table").on("click","a.del",function(b){b.preventDefault();v=$(this).parent().parent().parent().attr("id");s=$(this).parent().parent().parent();$("#spnProjName").text(t[v].name);$("#modalDelAlert").modal()});$("div.div_table").on("click","a.modify",function(b){b.preventDefault();$("#modalAct").text("Modify");r="MODIFY";v=$(this).parent().parent().parent().attr("id");$("#txtProjName").val(t[v].name);$("#txtWebLink").val(t[v].link);$("#txtDesc").val(t[v].desc);$("#modalAddMod").modal()});$("div.div_table").on("click","a.regen",function(b){b.preventDefault();o=$.inArray(v,u);i=v=$(this).parent().parent().parent().attr("id");s=$(this).parent().parent().parent();n=$(this).parent().parent().parent().children(".div_table_col_appkeys").children("span");a=t[v];$("#modalRegenAlert").modal()})});