Optimize focus controlbar logic.

This commit is contained in:
Kenshin 2016-12-20 13:53:04 +08:00
parent b31408f417
commit d436c8e65c
2 changed files with 6 additions and 4 deletions

View File

@ -61,7 +61,7 @@ function focuseMode() {
$( "body" ).append( '<div class="ks-simpread-bg"></div>' );
// add control bar
fcontrol.Init();
fcontrol.Init( ".ks-simpread-bg" );
// click mask remove it
$( ".ks-simpread-bg" ).on( "click", function( event ) {

View File

@ -8,9 +8,11 @@ var fcontrol = ( function() {
/*
Add focus constrol bar
*/
FControl.prototype.Init = function() {
FControl.prototype.Init = function( root ) {
var me = this;
$.get( chrome.extension.getURL( "/focus/template.html" ), function( tmpl ) {
$( ".ks-simpread-bg" ).append( tmpl );
me.constructor.prototype.$root = $(root);
$( root ).append( tmpl );
$target = $( ".ks-simpread-constrolbar" ).find( "span" );
addStyle();
addEventHandler();
@ -49,7 +51,7 @@ var fcontrol = ( function() {
break;
case "closeicon":
console.log("333")
$(".ks-simpread-bg").click();
FControl.prototype.$root.click();
break;
}
})