Skip to content

Commit 73dc696

Browse files
committed
Merge sidebar js, css
1 parent 52ed8c1 commit 73dc696

2 files changed

Lines changed: 60 additions & 6 deletions

File tree

plugins/Sidebar/media/all.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,10 @@
128128
.sidebar .link-right { color: white; text-decoration: none; border-bottom: 1px solid #666; text-transform: uppercase; }
129129
.sidebar .link-right:hover { border-color: #CCC; }
130130
.sidebar .link-right:active { background-color: #444 }
131+
.sidebar .link-outline { outline: 1px solid #eee6; padding: 2px 13px; border-bottom: none; font-size: 80%; }
131132
/* SIDEBAR */
132133

133-
.sidebar-container { width: 100%; height: 100%; overflow: hidden; position: fixed; z-index: 2; }
134+
.sidebar-container { width: 100%; height: 100%; overflow: hidden; position: fixed; top: 0px; z-index: 2;}
134135
.sidebar { background-color: #212121; position: fixed; -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; -o-backface-visibility: hidden; -ms-backface-visibility: hidden; backface-visibility: hidden ; right: -1200px; height: 100%; width: 1200px; } /*box-shadow: inset 0px 0px 10px #000*/
135136
.sidebar .content { margin: 30px; font-family: "Segoe UI Light", "Segoe UI", "Helvetica Neue"; color: white; width: 375px; height: 300px; font-weight: 200; -webkit-transition: all 1s; -moz-transition: all 1s; -o-transition: all 1s; -ms-transition: all 1s; transition: all 1s ; opacity: 0 }
136137
.sidebar-container.loaded .content { opacity: 1; -webkit-transform: none ; -moz-transform: none ; -o-transform: none ; -ms-transform: none ; transform: none }

plugins/Sidebar/media/all.js

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@
114114
})(this);
115115
$(window).on("hashchange", (function(_this) {
116116
return function() {
117-
if (window.top.location.hash === "#ZeroNet:Console") {
117+
if (window.top.location.hash.startsWith("#ZeroNet:Console")) {
118118
return _this.open();
119119
}
120120
};
121121
})(this));
122-
if (window.top.location.hash === "#ZeroNet:Console") {
122+
if (window.top.location.hash.startsWith("#ZeroNet:Console")) {
123123
setTimeout(((function(_this) {
124124
return function() {
125125
return _this.open();
@@ -151,12 +151,17 @@
151151
tab_type = ref[j];
152152
tab = $("<a></a>", {
153153
href: "#",
154-
"data-filter": tab_type.filter
154+
"data-filter": tab_type.filter,
155+
"data-title": tab_type.title
155156
}).text(tab_type.title);
156157
if (tab_type.filter === this.tab_active) {
157158
tab.addClass("active");
158159
}
159160
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+
}
160165
this.tabs.append(tab);
161166
}
162167
this.container.on("mousedown touchend touchcancel", (function(_this) {
@@ -342,6 +347,7 @@
342347
$("a", this.tabs).removeClass("active");
343348
elem.addClass("active");
344349
this.changeFilter(this.tab_active);
350+
window.top.location.hash = "#ZeroNet:Console:" + elem.data("title");
345351
return false;
346352
};
347353

@@ -353,6 +359,7 @@
353359

354360
}).call(this);
355361

362+
356363
/* ---- Menu.coffee ---- */
357364

358365

@@ -435,6 +442,40 @@
435442

436443
}).call(this);
437444

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+
438479
/* ---- RateLimit.coffee ---- */
439480

440481

@@ -1104,7 +1145,20 @@ window.initScrollable = function () {
11041145
})(this));
11051146
this.tag.find("#checkbox-owned").off("click touchend").on("click touchend", (function(_this) {
11061147
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+
});
11081162
};
11091163
})(this));
11101164
this.tag.find("#checkbox-autodownloadoptional").off("click touchend").on("click touchend", (function(_this) {
@@ -1370,7 +1424,6 @@ window.initScrollable = function () {
13701424

13711425
}).call(this);
13721426

1373-
13741427
/* ---- morphdom.js ---- */
13751428

13761429

0 commit comments

Comments
 (0)