Skip to content

Commit

Permalink
Rev885, Sidebar optimalization
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcutme committed Feb 4, 2016
1 parent 4cea7eb commit 31f108a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
7 changes: 3 additions & 4 deletions plugins/Sidebar/media/Sidebar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class Sidebar extends Class
if @tag.find(".content").children().length == 0 # First update
@log "Creating content"
morphdom(@tag.find(".content")[0], '<div class="content">'+res+'</div>')
@scrollable()
# @scrollable()

else # Not first update, patch the html to keep unchanged dom elements
@log "Patching content"
Expand All @@ -152,11 +152,10 @@ class Sidebar extends Class
mousex = (e.pageX + (@fixbutton_initx-@width)*overdrag_percent)/(1+overdrag_percent)
targetx = @fixbutton_initx-mousex-@fixbutton_addx

@fixbutton.offset
left: mousex+@fixbutton_addx
@fixbutton[0].style.left = (mousex+@fixbutton_addx)+"px"

if @tag
@tag.css("transform", "translateX(#{0-targetx}px)")
@tag[0].style.transform = "translateX(#{0-targetx}px)"

# Check if opened
if (not @opened and targetx > @width/3) or (@opened and targetx > @width*0.9)
Expand Down
8 changes: 4 additions & 4 deletions plugins/Sidebar/media/Sidebar.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
.drag-bg { width: 100%; height: 100%; position: absolute; }
.drag-bg { width: 100%; height: 100%; position: fixed; }
.fixbutton.dragging { cursor: -webkit-grabbing; }
.fixbutton-bg:active { cursor: -webkit-grabbing; }


.body-sidebar { background-color: #666 !important; }
#inner-iframe { transition: 0.3s ease-in-out; transform-origin: left; backface-visibility: hidden; outline: 1px solid transparent }
#inner-iframe { transition: 0.3s ease-in-out; transform-origin: left; outline: 1px solid transparent; }
.body-sidebar iframe { transform: rotateY(5deg); opacity: 0.8; pointer-events: none } /* translateX(-200px) scale(0.95)*/

/* SIDEBAR */

.sidebar-container { width: 100%; height: 100%; overflow: hidden; position: absolute; }
.sidebar { background-color: #212121; position: absolute; right: -1200px; height: 100%; width: 1200px; } /*box-shadow: inset 0px 0px 10px #000*/
.sidebar-container { width: 100%; height: 100%; overflow: hidden; position: fixed; }
.sidebar { background-color: #212121; position: fixed; backface-visibility: hidden; right: -1200px; height: 100%; width: 1200px; } /*box-shadow: inset 0px 0px 10px #000*/
.sidebar .content { margin: 30px; font-family: "Segoe UI Light", "Segoe UI", "Helvetica Neue"; color: white; width: 375px; height: 300px; font-weight: 200 }
.sidebar h1, .sidebar h2 { font-weight: lighter; }
.sidebar .button { margin: 0px; display: inline-block; }
Expand Down
8 changes: 4 additions & 4 deletions plugins/Sidebar/media/all.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@
/* ---- plugins/Sidebar/media/Sidebar.css ---- */


.drag-bg { width: 100%; height: 100%; position: absolute; }
.drag-bg { width: 100%; height: 100%; position: fixed; }
.fixbutton.dragging { cursor: -webkit-grabbing; }
.fixbutton-bg:active { cursor: -webkit-grabbing; }


.body-sidebar { background-color: #666 !important; }
#inner-iframe { -webkit-transition: 0.3s ease-in-out; -moz-transition: 0.3s ease-in-out; -o-transition: 0.3s ease-in-out; -ms-transition: 0.3s ease-in-out; transition: 0.3s ease-in-out ; transform-origin: left; -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; -o-backface-visibility: hidden; -ms-backface-visibility: hidden; backface-visibility: hidden ; outline: 1px solid transparent }
#inner-iframe { -webkit-transition: 0.3s ease-in-out; -moz-transition: 0.3s ease-in-out; -o-transition: 0.3s ease-in-out; -ms-transition: 0.3s ease-in-out; transition: 0.3s ease-in-out ; transform-origin: left; outline: 1px solid transparent; }
.body-sidebar iframe { -webkit-transform: rotateY(5deg); -moz-transform: rotateY(5deg); -o-transform: rotateY(5deg); -ms-transform: rotateY(5deg); transform: rotateY(5deg) ; opacity: 0.8; pointer-events: none } /* translateX(-200px) scale(0.95)*/

/* SIDEBAR */

.sidebar-container { width: 100%; height: 100%; overflow: hidden; position: absolute; }
.sidebar { background-color: #212121; position: absolute; right: -1200px; height: 100%; width: 1200px; } /*box-shadow: inset 0px 0px 10px #000*/
.sidebar-container { width: 100%; height: 100%; overflow: hidden; position: fixed; }
.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*/
.sidebar .content { margin: 30px; font-family: "Segoe UI Light", "Segoe UI", "Helvetica Neue"; color: white; width: 375px; height: 300px; font-weight: 200 }
.sidebar h1, .sidebar h2 { font-weight: lighter; }
.sidebar .button { margin: 0px; display: inline-block; }
Expand Down
9 changes: 3 additions & 6 deletions plugins/Sidebar/media/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,7 @@ window.initScrollable = function () {
return function(res) {
if (_this.tag.find(".content").children().length === 0) {
_this.log("Creating content");
morphdom(_this.tag.find(".content")[0], '<div class="content">' + res + '</div>');
return _this.scrollable();
return morphdom(_this.tag.find(".content")[0], '<div class="content">' + res + '</div>');
} else {
_this.log("Patching content");
return morphdom(_this.tag.find(".content")[0], '<div class="content">' + res + '</div>', {
Expand All @@ -332,11 +331,9 @@ window.initScrollable = function () {
mousex = (e.pageX + (this.fixbutton_initx - this.width) * overdrag_percent) / (1 + overdrag_percent);
}
targetx = this.fixbutton_initx - mousex - this.fixbutton_addx;
this.fixbutton.offset({
left: mousex + this.fixbutton_addx
});
this.fixbutton[0].style.left = (mousex + this.fixbutton_addx) + "px";
if (this.tag) {
this.tag.css("transform", "translateX(" + (0 - targetx) + "px)");
this.tag[0].style.transform = "translateX(" + (0 - targetx) + "px)";
}
if ((!this.opened && targetx > this.width / 3) || (this.opened && targetx > this.width * 0.9)) {
return this.fixbutton_targetx = this.fixbutton_initx - this.width;
Expand Down
2 changes: 1 addition & 1 deletion src/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Config(object):

def __init__(self, argv):
self.version = "0.3.6"
self.rev = 884
self.rev = 885
self.argv = argv
self.action = None
self.config_file = "zeronet.conf"
Expand Down

0 comments on commit 31f108a

Please sign in to comment.