client/js/main.js
changeset 69 f0873867143a
parent 68 803dbeb7c919
child 70 47b3125130a2
equal deleted inserted replaced
68:803dbeb7c919 69:f0873867143a
    26 
    26 
    27 Rkns._ = _;
    27 Rkns._ = _;
    28 
    28 
    29 Rkns.VERSION = '0.2';
    29 Rkns.VERSION = '0.2';
    30 
    30 
    31 Rkns.pickerColors = ["#8f1919", "#a80000", "#d82626", "#ff0000", "#e87c7c", "#ff6565", "#f7d3d3", "#fecccc", "#8f5419", "#a85400", "#d87f26", "#ff7f00", "#e8b27c", "#ffb265", "#f7e5d3", "#fee5cc", "#8f8f19", "#a8a800", "#d8d826", "#feff00", "#e8e87c", "#feff65", "#f7f7d3", "#fefecc", "#198f19", "#00a800", "#26d826", "#00ff00", "#7ce87c", "#65ff65", "#d3f7d3", "#ccfecc", "#198f8f", "#00a8a8", "#26d8d8", "#00feff", "#7ce8e8", "#65feff", "#d3f7f7", "#ccfefe", "#19198f", "#0000a8", "#2626d8", "#0000ff", "#7c7ce8", "#6565ff", "#d3d3f7", "#ccccfe", "#8f198f", "#a800a8", "#d826d8", "#ff00fe", "#e87ce8", "#ff65fe", "#f7d3f7", "#feccfe", "#000000", "#242424", "#484848", "#6d6d6d", "#919191", "#b6b6b6", "#dadada", "#ffffff"];
    31 Rkns.pickerColors = ["#8f1919", "#a80000", "#d82626", "#ff0000", "#e87c7c", "#ff6565", "#f7d3d3", "#fecccc",
       
    32     "#8f5419", "#a85400", "#d87f26", "#ff7f00", "#e8b27c", "#ffb265", "#f7e5d3", "#fee5cc",
       
    33     "#8f8f19", "#a8a800", "#d8d826", "#feff00", "#e8e87c", "#feff65", "#f7f7d3", "#fefecc",
       
    34     "#198f19", "#00a800", "#26d826", "#00ff00", "#7ce87c", "#65ff65", "#d3f7d3", "#ccfecc",
       
    35     "#198f8f", "#00a8a8", "#26d8d8", "#00feff", "#7ce8e8", "#65feff", "#d3f7f7", "#ccfefe",
       
    36     "#19198f", "#0000a8", "#2626d8", "#0000ff", "#7c7ce8", "#6565ff", "#d3d3f7", "#ccccfe",
       
    37     "#8f198f", "#a800a8", "#d826d8", "#ff00fe", "#e87ce8", "#ff65fe", "#f7d3f7", "#feccfe",
       
    38     "#000000", "#242424", "#484848", "#6d6d6d", "#919191", "#b6b6b6", "#dadada", "#ffffff"];
    32 
    39 
    33 Rkns._BaseBin = function(_renkan, _opts) {
    40 Rkns._BaseBin = function(_renkan, _opts) {
    34     if (typeof _renkan !== "undefined") {
    41     if (typeof _renkan !== "undefined") {
    35         this.renkan = _renkan;
    42         this.renkan = _renkan;
    36         this.renkan.$.find(".Rk-Bin-Main").hide();
    43         this.renkan.$.find(".Rk-Bin-Main").hide();
   120     		Rkns.$.getJSON(f, function(data) {
   127     		Rkns.$.getJSON(f, function(data) {
   121     			_this.properties = _this.properties.concat(data);
   128     			_this.properties = _this.properties.concat(data);
   122     		});
   129     		});
   123     	});
   130     	});
   124     }
   131     }
       
   132     if (typeof _opts.bookmarklet_url !== "string") {
       
   133         _opts.bookmarklet_url = "js/bookmarklet.js";
       
   134     }
   125     this.project = new Rkns.Models.Project();
   135     this.project = new Rkns.Models.Project();
   126     this.language = _opts.language;
   136     this.language = _opts.language;
   127     this.static_url = _opts.static_url;
   137     this.static_url = _opts.static_url;
   128     this.show_bins = _opts.show_bins;
   138     this.show_bins = _opts.show_bins;
   129     this.read_only = _opts.read_only;
   139     this.read_only = _opts.read_only;
   130     this.properties = _opts.properties;
   140     this.properties = _opts.properties;
       
   141     
       
   142     function getAbsoluteURL(url) {
       
   143         var tmp = document.createElement('img');
       
   144         tmp.src = url;
       
   145         var res = tmp.src;
       
   146         tmp.src = null;
       
   147         return res;
       
   148     }
       
   149     
       
   150     this.bookmarklet_url = getAbsoluteURL(_opts.bookmarklet_url);
       
   151     
   131     this.translate = function(_text) {
   152     this.translate = function(_text) {
   132     	return (Rkns.i18n[_opts.language] || Rkns.i18n[_opts.language.substr(0,2)] || {})[_text] || _text;
   153     	return (Rkns.i18n[_opts.language] || Rkns.i18n[_opts.language.substr(0,2)] || {})[_text] || _text;
   133     }
   154     }
   134     if (typeof _opts.user_id !== "undefined") {
   155     if (typeof _opts.user_id !== "undefined") {
   135         this.current_user = _opts.user_id;
   156         this.current_user = _opts.user_id;
   228         return false
   249         return false
   229     });
   250     });
   230 }
   251 }
   231 
   252 
   232 Rkns.Renkan.prototype.template = Rkns._.template(
   253 Rkns.Renkan.prototype.template = Rkns._.template(
   233     '<% if (show_bins) { %><div class="Rk-Title"><h1><%- translate("Renkan") %></h1></div><div class="Rk-Bins">'
   254     '<% if (show_bins) { %><div class="Rk-Bins"><h2 class="Rk-Bins-Title"><%- translate("Select contents:")%></h2>'
   234     + '<form class="Rk-Web-Search-Form Rk-Search-Form"><input class="Rk-Web-Search-Input Rk-Search-Input" type="search" placeholder="<%- translate("Search the Web") %>" />'
   255     + '<form class="Rk-Web-Search-Form Rk-Search-Form"><input class="Rk-Web-Search-Input Rk-Search-Input" type="search" placeholder="<%- translate("Search the Web") %>" />'
   235     + '<div class="Rk-Search-Select"><div class="Rk-Search-Current"></div><ul class="Rk-Search-List"></ul></div>'
   256     + '<div class="Rk-Search-Select"><div class="Rk-Search-Current"></div><ul class="Rk-Search-List"></ul></div>'
   236     + '<input type="submit" value="" class="Rk-Web-Search-Submit Rk-Search-Submit" /></form>'
   257     + '<input type="submit" value="" class="Rk-Web-Search-Submit Rk-Search-Submit" /></form>'
   237     + '<form class="Rk-Bins-Search-Form Rk-Search-Form"><input class="Rk-Bins-Search-Input Rk-Search-Input" type="search" placeholder="<%- translate("Search in Bins") %>" />'
   258     + '<form class="Rk-Bins-Search-Form Rk-Search-Form"><input class="Rk-Bins-Search-Input Rk-Search-Input" type="search" placeholder="<%- translate("Search in Bins") %>" />'
   238     + '<input type="submit" value="" class="Rk-Bins-Search-Submit Rk-Search-Submit" /></form>'
   259     + '<input type="submit" value="" class="Rk-Bins-Search-Submit Rk-Search-Submit" /></form>'