Skip to content

Commit

Permalink
Merge branch 'release/1.5.4.0202'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenshin committed Feb 2, 2019
2 parents a300e85 + b29b322 commit cc756b3
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 6 deletions.
8 changes: 8 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
"message": "Send to Mobile"
},

"controlbar_desktop": {
"message": "Set wallpaper"
},

"controlbar_favorite": {
"message": "Like"
},
Expand Down Expand Up @@ -505,6 +509,10 @@
"message": "Custom CSS"
},

"zen_mode_setting_script": {
"message": "Custom Script"
},

"zen_mode_setting_import": {
"message": "Import"
},
Expand Down
8 changes: 8 additions & 0 deletions _locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
"message": "发送到手机"
},

"controlbar_desktop": {
"message": "设为桌面背景"
},

"controlbar_favorite": {
"message": "收藏"
},
Expand Down Expand Up @@ -505,6 +509,10 @@
"message": "自定义样式"
},

"zen_mode_setting_script": {
"message": "自定义脚本"
},

"zen_mode_setting_import": {
"message": "导入配置"
},
Expand Down
8 changes: 8 additions & 0 deletions _locales/zh_TW/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
"message": "發送到手機"
},

"controlbar_desktop": {
"message": "設為桌面背景"
},

"controlbar_favorite": {
"message": "收藏"
},
Expand Down Expand Up @@ -505,6 +509,10 @@
"message": "自定義樣式"
},

"zen_mode_setting_script": {
"message": "自定義腳本"
},

"zen_mode_setting_import": {
"message": "導入配置"
},
Expand Down
11 changes: 8 additions & 3 deletions assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ img {
background-image: url("../images/mobile.png");
}

.desktopicon {
background-image: url("../images/desktop.png");
}

/*
* clock
*/
Expand Down Expand Up @@ -1547,7 +1551,7 @@ img {
bottom: 5px;

width: 500px;
height: 400px;
height: 420px;

padding: 15px;

Expand Down Expand Up @@ -1856,7 +1860,7 @@ img {
bottom: 10px;

width: 400px;
height: 465px;
height: 575px;

padding: 15px;

Expand Down Expand Up @@ -2048,7 +2052,8 @@ img {
font-size: large!important;
}

.setting-zen-mode .css textarea {
.setting-zen-mode .css textarea,
.setting-zen-mode .script textarea {
max-width: 395px;
height: 60px;
}
Expand Down
Binary file added assets/images/desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ define([ "jquery", "date", "i18n", "setting", "apis", "vo", "files", "controlbar
console.log( "======= New Background Obj is ", vo );
localStorage[ "simptab-background-mode" ] == "time" && history.Add( vo.new );
localStorage[ "simptab-background-mode" ] == "time" && $( "body" ).hasClass("bgearth") && $( "body" ).removeClass( "bgearth" );
// test code
//localStorage[ "simptab-background-mode" ] == "time" && $( ".controlink[url=desktop]" )[0].click();
}
}

Expand Down
24 changes: 24 additions & 0 deletions js/controlbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ define([ "jquery", "i18n", "vo", "date", "files", "setting", "manage", "about",
$( $( ".controlbar" ).find( "a" )[2] ).parent().removeClass( "horz-toolbox-show-3" );
});

$( ".controlink[url=mobile]" ).mouseenter( function( event ) {
$( ".controlink[url=mobile]" ).prev().addClass( "horz-toolbox-show" );
$( ".controlink[url=desktop]" ).parent().addClass( "horz-toolbox-show-1" );
});

$($( ".controlbar li" )[12]).mouseleave( function( event ) {
$( ".controlink[url=mobile]" ).prev().removeClass( "horz-toolbox-show" );
$( ".controlink[url=desktop]" ).parent().removeClass( "horz-toolbox-show-1" );
});

// listen control link
$( ".controlink" ).click( function( event ) {
var $target = $( event.currentTarget ),
Expand Down Expand Up @@ -228,6 +238,20 @@ define([ "jquery", "i18n", "vo", "date", "files", "setting", "manage", "about",
new Notify().Render( 2, i18n.GetLang( "notify_mobile_send_failed" ) );
});
break;
case "desktop":
$.ajax({
type : "POST",
url : "http://localhost:56789/save",
data : files.DataURI(),
}).then( function( result ) {
result = JSON.parse( result );
if ( result && result.code == 200 ) {
new Notify().Render( "已成功发送到本地。" );
}
} , function( jqXHR, textStatus, errorThrown ) {
console.log( jqXHR, textStatus, errorThrown )
});
break;
}
});
},
Expand Down
1 change: 1 addition & 0 deletions js/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ define([ "jquery" ], function( $ ) {
$( ".controlbar" ).find( "a[url=options]" ).attr("data-balloon", i18n( "controlbar_options" ));
$( ".controlbar" ).find( "a[url=about]" ).attr("data-balloon", i18n( "controlbar_about" ));
$( ".controlbar" ).find( "a[url=mobile]" ).attr("data-balloon", i18n( "controlbar_mobile" ));
$( ".controlbar" ).find( "a[url=desktop]" ).attr("data-balloon", i18n( "controlbar_desktop" ));
$( ".controlbar" ).find( "a[url=favorite]" ).attr("data-balloon", i18n( "controlbar_favorite" ));
$( ".controlbar" ).find( "a[url=pin]" ).attr("data-balloon", i18n( "controlbar_pin" ));
$( ".controlbar" ).find( "a[url=dislike]" ).attr("data-balloon", i18n( "controlbar_dislike" ));
Expand Down
3 changes: 2 additions & 1 deletion js/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ define([ "jquery", "mousetrap", "controlbar", "i18n", "topsites", "message" ], f
{ short: "o", long: "options" },
{ short: "t", long: "about" },
{ short: "s", long: "setting" },
{ short: "b", long: "mobile" },
{ short: "d", long: "desktop" },
{ short: "e", long: "mobile" },
{ short: "a", long: "favorite" },
{ short: "n", long: "pin" },
{ short: "u", long: "dislike" },
Expand Down
36 changes: 36 additions & 0 deletions js/zen.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ define([ "jquery", "mousetrap", "lodash", "notify", "i18n", "message", "comps" ]
devices : { color: "", display: "true" },
topsites: { display: "true" },
css : "",
script : "",
version : chrome.runtime.getManifest().version.replace( /.\d{2,}/, "" ),
},
key = "simptab-tenmode-option",
Expand Down Expand Up @@ -92,6 +93,19 @@ define([ "jquery", "mousetrap", "lodash", "notify", "i18n", "message", "comps" ]
$( "head" ).append( '<style id="zen-mode-style" type="text/css">' + storage.db.css + '</style>' );
}

function run() {
try {
var func = function ( source ) {
window.Notify = Notify;
window.template = _.template;
return '( function ( $$version, Notify, template ) {' + source + '})( "0.0.1", Notify, template );'
};
new Function( func( storage.db.script ) )();
} catch ( error ) {
console.error( error )
}
}

function correctWinSize() {
navigator.platform.toLowerCase() == "win32" && storage.db.size == "middle" && $( "#time" ).addClass( "time-zen-mode-middle-win" );
navigator.platform.toLowerCase() == "win32" && storage.db.size == "large" && $( "#time" ).addClass( "time-zen-mode-large-win" );
Expand Down Expand Up @@ -250,6 +264,22 @@ define([ "jquery", "mousetrap", "lodash", "notify", "i18n", "message", "comps" ]
});
}

/*********************************************
* Script
*********************************************/

function scriptView() {
return '<div class="content"><textarea class="md-textarea"></textarea></div>';
}

function scriptModel() {
$( ".setting-zen-mode .script textarea" ).val( storage.db.script );
$( ".setting-zen-mode" ).on( "keyup", ".script textarea", function( event ) {
storage.db.script = event.target.value;
storage.Set();
});
}

/*********************************************
* Footer
*********************************************/
Expand Down Expand Up @@ -312,6 +342,10 @@ define([ "jquery", "mousetrap", "lodash", "notify", "i18n", "message", "comps" ]
<div class="title">' + i18n.GetLang( "zen_mode_setting_css" ) + '</div>\
' + cssView() + '\
</div>\
<div class="script" style="margin-top: 15px;">\
<div class="title">' + i18n.GetLang( "zen_mode_setting_script" ) + '</div>\
' + scriptView() + '\
</div>\
<div class="footer">\
<div class="waves-effect button import">' + i18n.GetLang( "zen_mode_setting_import" ) + '</div>\
<div class="waves-effect button export">' + i18n.GetLang( "zen_mode_setting_export" ) + '</div>\
Expand All @@ -324,6 +358,7 @@ define([ "jquery", "mousetrap", "lodash", "notify", "i18n", "message", "comps" ]
themeModel();
moduleModel();
cssModel();
scriptModel();
footerModel();
}

Expand Down Expand Up @@ -373,6 +408,7 @@ define([ "jquery", "mousetrap", "lodash", "notify", "i18n", "message", "comps" ]
$( ".controlbar" ).addClass( "controlbar-zen-mode" );
$( ".progress" ).addClass( "progress-zen-mode" );
$( ".clock" ).append( '<div class="setting-trigger-zen-mode"></div>' );
storage.db.script != "" && run();
custom();
storage.db.theme == "#ffffff" && $( ".setting-trigger-zen-mode" ).addClass( "setting-trigger-white-zen-mode" );
$( ".setting-trigger-zen-mode" ).on( "click", function( event ) {
Expand Down
7 changes: 6 additions & 1 deletion main.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
</ul>
<a data-balloon="Option" data-balloon-pos="up" class="controlink" href="#" url="setting"><span class="icon settingicon"></span></a>
</li>
<li><a data-balloon="Mobile" data-balloon-pos="left" class="controlink" href="#" url="mobile"><span class="icon mobileicon"></span></a></li>
<li>
<ul class="horz-toolbox">
<li><a style="display: none;" data-balloon="Desktop" data-balloon-pos="up" class="controlink" href="#" url="desktop"><span class="icon desktopicon"></span></a></li>
</ul>
<a data-balloon="Mobile" data-balloon-pos="up" class="controlink" href="#" url="mobile"><span class="icon mobileicon"></span></a>
</li>
<li><a data-balloon="Favorite" data-balloon-pos="left" class="controlink" href="#" url="favorite"><span class="icon unfavoriteicon"></span></a></li>
<li><a data-balloon="Pin" data-balloon-pos="left" class="controlink" href="#" url="pin"><span class="icon pin"></span></a></li>
<li><a data-balloon="Dislike" data-balloon-pos="left"class="controlink" href="#" url="dislike"><span class="icon dislike"></span></a></li>
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name" : "__MSG_extension_name__",
"short_name" : "SimpTab",
"version" : "1.5.4",
"version" : "1.5.4.202",
"default_locale" : "zh_CN",
"description" : "__MSG_extension_desc__",
"author" : "Kenshin",
Expand Down

0 comments on commit cc756b3

Please sign in to comment.