|
114 | 114 | })(this); |
115 | 115 | $(window).on("hashchange", (function(_this) { |
116 | 116 | return function() { |
117 | | - if (window.top.location.hash === "#ZeroNet:Console") { |
| 117 | + if (window.top.location.hash.startsWith("#ZeroNet:Console")) { |
118 | 118 | return _this.open(); |
119 | 119 | } |
120 | 120 | }; |
121 | 121 | })(this)); |
122 | | - if (window.top.location.hash === "#ZeroNet:Console") { |
| 122 | + if (window.top.location.hash.startsWith("#ZeroNet:Console")) { |
123 | 123 | setTimeout(((function(_this) { |
124 | 124 | return function() { |
125 | 125 | return _this.open(); |
|
151 | 151 | tab_type = ref[j]; |
152 | 152 | tab = $("<a></a>", { |
153 | 153 | href: "#", |
154 | | - "data-filter": tab_type.filter |
| 154 | + "data-filter": tab_type.filter, |
| 155 | + "data-title": tab_type.title |
155 | 156 | }).text(tab_type.title); |
156 | 157 | if (tab_type.filter === this.tab_active) { |
157 | 158 | tab.addClass("active"); |
158 | 159 | } |
159 | 160 | tab.on("click", this.handleTabClick); |
| 161 | + if (window.top.location.hash.endsWith(tab_type.title)) { |
| 162 | + this.log("Triggering click on", tab); |
| 163 | + tab.trigger("click"); |
| 164 | + } |
160 | 165 | this.tabs.append(tab); |
161 | 166 | } |
162 | 167 | this.container.on("mousedown touchend touchcancel", (function(_this) { |
|
342 | 347 | $("a", this.tabs).removeClass("active"); |
343 | 348 | elem.addClass("active"); |
344 | 349 | this.changeFilter(this.tab_active); |
| 350 | + window.top.location.hash = "#ZeroNet:Console:" + elem.data("title"); |
345 | 351 | return false; |
346 | 352 | }; |
347 | 353 |
|
|
353 | 359 |
|
354 | 360 | }).call(this); |
355 | 361 |
|
| 362 | + |
356 | 363 | /* ---- Menu.coffee ---- */ |
357 | 364 |
|
358 | 365 |
|
|
435 | 442 |
|
436 | 443 | }).call(this); |
437 | 444 |
|
| 445 | +/* ---- Prototypes.coffee ---- */ |
| 446 | + |
| 447 | + |
| 448 | +(function() { |
| 449 | + String.prototype.startsWith = function(s) { |
| 450 | + return this.slice(0, s.length) === s; |
| 451 | + }; |
| 452 | + |
| 453 | + String.prototype.endsWith = function(s) { |
| 454 | + return s === '' || this.slice(-s.length) === s; |
| 455 | + }; |
| 456 | + |
| 457 | + String.prototype.capitalize = function() { |
| 458 | + if (this.length) { |
| 459 | + return this[0].toUpperCase() + this.slice(1); |
| 460 | + } else { |
| 461 | + return ""; |
| 462 | + } |
| 463 | + }; |
| 464 | + |
| 465 | + String.prototype.repeat = function(count) { |
| 466 | + return new Array(count + 1).join(this); |
| 467 | + }; |
| 468 | + |
| 469 | + window.isEmpty = function(obj) { |
| 470 | + var key; |
| 471 | + for (key in obj) { |
| 472 | + return false; |
| 473 | + } |
| 474 | + return true; |
| 475 | + }; |
| 476 | + |
| 477 | +}).call(this); |
| 478 | + |
438 | 479 | /* ---- RateLimit.coffee ---- */ |
439 | 480 |
|
440 | 481 |
|
@@ -1104,7 +1145,20 @@ window.initScrollable = function () { |
1104 | 1145 | })(this)); |
1105 | 1146 | this.tag.find("#checkbox-owned").off("click touchend").on("click touchend", (function(_this) { |
1106 | 1147 | return function() { |
1107 | | - return _this.wrapper.ws.cmd("siteSetOwned", [_this.tag.find("#checkbox-owned").is(":checked")]); |
| 1148 | + var owned; |
| 1149 | + owned = _this.tag.find("#checkbox-owned").is(":checked"); |
| 1150 | + return _this.wrapper.ws.cmd("siteSetOwned", [owned], function(res_set_owned) { |
| 1151 | + _this.log("Owned", owned); |
| 1152 | + if (owned) { |
| 1153 | + return _this.wrapper.ws.cmd("siteRecoverPrivatekey", [], function(res_recover) { |
| 1154 | + if (res_recover === "ok") { |
| 1155 | + return _this.wrapper.notifications.add("recover", "done", "Private key recovered from master seed", 5000); |
| 1156 | + } else { |
| 1157 | + return _this.log("Unable to recover private key: " + res_recover.error); |
| 1158 | + } |
| 1159 | + }); |
| 1160 | + } |
| 1161 | + }); |
1108 | 1162 | }; |
1109 | 1163 | })(this)); |
1110 | 1164 | this.tag.find("#checkbox-autodownloadoptional").off("click touchend").on("click touchend", (function(_this) { |
@@ -1370,7 +1424,6 @@ window.initScrollable = function () { |
1370 | 1424 |
|
1371 | 1425 | }).call(this); |
1372 | 1426 |
|
1373 | | - |
1374 | 1427 | /* ---- morphdom.js ---- */ |
1375 | 1428 |
|
1376 | 1429 |
|
|
0 commit comments