[refactor] improve page lock render

This commit is contained in:
Kuldeep M 2019-07-15 18:04:32 +01:00
parent c5f5e1b2d4
commit db89344153
5 changed files with 15 additions and 15 deletions

View File

@ -1181,7 +1181,7 @@
<script src="js/background.js"></script>
<script src="js/layout.js"></script>
<script src="js/auto-suggest.js"></script>
<script src="js/page.js"></script>
<script src="js/pagelock.js"></script>
<script src="js/edge.js"></script>
<script src="js/init.js"></script>

View File

@ -5,7 +5,7 @@ var control = (function() {
type: "button",
func: function() {
menu.toggle();
page.update();
pagelock.render.toggle();
}
}, {
element: helper.e(".control-link-add"),

View File

@ -11,7 +11,7 @@ var menu = (function() {
menuClose.addEventListener("click", function() {
close();
shade.destroy();
page.update();
pagelock.render.toggle();
}, false);
};
@ -88,7 +88,7 @@ var menu = (function() {
shade.render({
action: function() {
close();
page.update();
pagelock.render.toggle();
}
});
} else {

View File

@ -105,7 +105,7 @@ var modal = (function() {
};
this.destroy();
shade.destroy();
page.update();
pagelock.render.toggle();
}.bind(modal), false);
cancelButton.addEventListener("click", function(event) {
if (options.cancelAction) {
@ -113,7 +113,7 @@ var modal = (function() {
};
this.destroy();
shade.destroy();
page.update();
pagelock.render.toggle();
}.bind(modal), false);
previousModal = modal;
shade.render({
@ -122,7 +122,7 @@ var modal = (function() {
options.cancelAction();
};
modal.destroy();
page.update();
pagelock.render.toggle();
},
includeHeader: true
});
@ -136,7 +136,7 @@ var modal = (function() {
destroy();
};
_makeModal();
page.update();
pagelock.render.toggle();
};
// exposed methods

View File

@ -1,6 +1,8 @@
var page = (function() {
var pagelock = (function() {
var update = function() {
var render = {};
render.toggle = function() {
var body = helper.e("body");
var menu = state.get().menu;
var modal = state.get().modal;
@ -12,21 +14,19 @@ var page = (function() {
};
};
var lock = function() {
render.lock = function() {
var body = helper.e("body");
helper.addClass(body, "scroll-disabled");
};
var unlock = function() {
render.unlock = function() {
var body = helper.e("body");
helper.removeClass(body, "scroll-disabled");
};
// exposed methods
return {
lock: lock,
unlock: unlock,
update: update
render: render
};
})();