{"size": 6586, "ext": "js", "max_stars_repo_path": "src/js/config.min.js", "max_stars_repo_name": "floodfx/chrome-sdb", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/js/config.min.js", "max_issues_repo_name": "floodfx/chrome-sdb", "max_issues_repo_issues_event_min_datetime": "2020-03-21T01:18:45.000Z", "max_issues_repo_issues_event_max_datetime": "2020-03-21T01:18:45.000Z", "max_forks_repo_path": "src/js/config.min.js", "max_forks_repo_name": "floodfx/chrome-sdb", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 387.4117647059, "max_line_length": 559, "alphanum_fraction": 0.7282113574}
(function(){var after_intro;after_intro=function(){Storage.set("chrome-sdb-config-intro","true");$("#create_profile_modal").modal("show");return guiders.hideAll()};$(function(){if(Storage.get("chrome-sdb-config-intro")===null)return guiders.createGuider({buttons:[{name:"Close",onclick:after_intro}],description:"Welcome to Simple DB Tool for Chrome.  Please setup one or more AWS Credentials to start using this tool!",id:"first",overlay:true,title:"Chrome Simple DB Tool: Configuration"}).show()});var Storage;
Storage=function(){var a;a={};a.get=function(b,c){var d;if(c==null)c=false;d=localStorage.getItem(b);if(c)d=JSON.parse(d);return d};a.set=function(b,c,d){if(d==null)d=false;if(d)c=JSON.stringify(c);localStorage.setItem(b,c);return c};a.del=function(b){return localStorage.removeItem(b)};return a}();var Profile;
Profile=function(){function a(b,c){this.name=b;this.settings=c}a.prototype.use_name=function(b){this.name=b;return this};a.prototype.use_settings=function(b){this.settings=b;return this};a.prototype.get_name=function(){return this.name};a.prototype.get_settings=function(){return this.settings};a.prototype.make_primary=function(){Storage.set("chrome-sdb.primary-profile",this.name);return this};a.prototype.save=function(b){var c,d,e,f,g;if(b==null)b=false;e=a.find_all();c=false;f=0;for(g=e.length;f<
g;f++){d=e[f];if(this.name===d.get_name()){d.use_settings(this.settings);c=true}}c||e.push(this);Storage.set("chrome-sdb.profiles",a.profiles_json(e),true);if(a.primary()===null||b)this.make_primary();return this};a.prototype["delete"]=function(){a["delete"](this.name);return null};a.prototype.to_json=function(){return{name:this.name,settings:this.settings.to_json()}};a.primary=function(){var b;b=Storage.get("chrome-sdb.primary-profile");return a.find(b)};a.from_json=function(b){return b?new a(b.name,
Settings.from_json(b.settings)):null};a.find_all=function(){var b,c,d,e;c=(e=Storage.get("chrome-sdb.profiles",true))!=null?e:{};return function(){var f;f=[];for(b in c){d=c[b];f.push(new a(b,Settings.from_json(d)))}return f}()};a.find=function(b){var c,d,e,f;d=a.find_all();e=0;for(f=d.length;e<f;e++){c=d[e];if(c.get_name()===b)return c}return null};a.profiles_json=function(b){var c,d,e,f;d={};e=0;for(f=b.length;e<f;e++){c=b[e];d[c.get_name()]=c.get_settings().to_json()}return d};a.delete_all=function(){return Storage.set("chrome-sdb.profiles",
{},true)};a["delete"]=function(b){var c,d,e,f,g;e=a.find_all();d=[];c=f=0;for(g=e.length;0<=g?f<g:f>g;c=0<=g?++f:--f)e[c].get_name()!==b&&d.push(e[c]);return Storage.set("chrome-sdb.profiles",a.profiles_json(d),true)};return a}();var Settings;
Settings=function(){function a(b,c,d,e,f){this.access_key=b;this.secret_key=c;this.region=d!=null?d:"sdb.amazonaws.com";this.version=e!=null?e:"2009-04-15";this.https_protocol=f!=null?f:false}a.prototype.use_access_key=function(b){this.access_key=b;return this};a.prototype.use_secret_key=function(b){this.secret_key=b;return this};a.prototype.use_region=function(b){this.region=b;return this};a.prototype.use_version=function(b){this.version=b;return this};a.prototype.use_https_protocol=function(b){this.https_protocol=
b;return this};a.prototype.get_access_key=function(){return this.access_key};a.prototype.get_secret_key=function(){return this.secret_key};a.prototype.get_region=function(){return this.region};a.prototype.get_version=function(){return this.version};a.prototype.get_use_https=function(){return this.https_protocol};a.prototype.to_json=function(){return{access_key:this.access_key,secret_key:this.secret_key,region:this.region,version:this.version,https_protocol:this.https_protocol}};a.from_json=function(b){return b?
new a(b.access_key,b.secret_key,b.region,b.version,b.https_protocol):null};return a}();var cancel_profile,delete_profile,edit_profile,message,primary,profiles,save_profile,update_profiles_table,use_profile,validate_text_box;primary=Profile.primary();profiles=Profile.find_all();
if(Profile.find_all()===[]){message='<div class="alert-message warning">\n  <a id="close_message_box" class="close" href="#">\u00d7</a>\n  <p><strong>Create a profile</strong> Enter your AWS Credentials to begin.</p>\n</div>';$(function(){$("#message_box").append(message).show();return $("#close_message_box").click(function(){return $("#message_box").hide()})})}else $(function(){return update_profiles_table()});
update_profiles_table=function(){var a,b,c,d,e,f,g,i,h;primary=Profile.primary();profiles=Profile.find_all();profiles.length>0&&$("#profiles_table > tbody").html("");h=[];f=0;for(g=profiles.length;f<g;f++){a=profiles[f];d=a.get_name();b=(i=primary!=null?primary.get_name():void 0)!=null?i:null;a=a.get_settings().get_access_key();e=d===b?"In use":$('<a class="btn" name="'+d+'" href="#">Use</a>').click(function(){return use_profile($(this).attr("name"))});c=$('<a href="#" name="'+d+'">Edit</a>').click(function(){return edit_profile($(this).attr("name"))});
b=$('<a href="#" name="'+d+'">Delete</a>').click(function(){return delete_profile($(this).attr("name"))});c=$("<td></td>").append(c);e=$("<td></td>").append(e);b=$("<td></td>").append(b);d=$("<tr><td>"+d+"</td><td>"+a+"</td></tr>").append(c).append(e).append(b);h.push($("#profiles_table > tbody").append(d))}return h};
save_profile=function(){var a,b,c;(a=true)&&(a=validate_text_box("#profile_name",3,30));a&&(a=validate_text_box("#profile_aws_access_key",15,25));a&&(a=validate_text_box("#profile_aws_secret_key",35,45));if(a){b=$("#profile_name").val();a=$("#profile_aws_access_key").val();c=$("#profile_aws_secret_key").val();(new Profile(b,new Settings(a,c))).save();$("#create_profile_modal").modal("hide");return update_profiles_table()}};
validate_text_box=function(a,b,c){var d;if(b==null)b=0;if(c==null)c=100;d=$(a).val();if(d===null||d.length<b||d.length>c){$(a).parentsUntil("fieldset").addClass("error");return false}else{$(a).parentsUntil("fieldset").removeClass("error");return true}};cancel_profile=function(){return $("#create_profile_modal").modal("hide")};
edit_profile=function(a){a=Profile.find(a);$("#profile_name").val(a.get_name());$("#profile_aws_access_key").val(a.get_settings().get_access_key());$("#profile_aws_secret_key").val(a.get_settings().get_secret_key());return $("#create_profile_modal").modal("show")};delete_profile=function(a){Profile["delete"](a);return update_profiles_table()};use_profile=function(a){Profile.find(a).make_primary();return update_profiles_table()};
$(function(){$("#save_profile").click(function(){return save_profile()});return $("#cancel_profile").click(function(){return cancel_profile()})});})();
