Skip to content
This repository was archived by the owner on Jul 27, 2024. It is now read-only.

Commit cc8b068

Browse files
committed
Merge branch 'dev'
2 parents 94b5b0a + 123af92 commit cc8b068

26 files changed

+424
-217
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
indent_style = space
6+
indent_size = 2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules/
33
*.bat
44
*.mxaddon
55
*.log
6+
*.lock

gulpfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const isProd = process.env.NODE_ENV === 'production';
1818

1919
const paths = {
2020
cache: 'src/cache.js',
21-
def: 'src/def.json',
21+
def: 'src/def.yml',
2222
templates: [
2323
'src/**/*.html',
2424
'!src/**/index.html',
@@ -51,7 +51,7 @@ gulp.task('watch', ['build'], () => {
5151
gulp.watch(paths.jsCollect, ['js']);
5252
gulp.watch(paths.copy, ['copy-files']);
5353
gulp.watch(paths.locales, ['copy-i18n']);
54-
gulp.watch(paths.def, ['copy-def']);
54+
gulp.watch(paths.def, ['manifest']);
5555
});
5656

5757
gulp.task('lint', () => (

scripts/json.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
const gutil = require('gulp-util');
22
const through = require('through2');
3+
const yaml = require('js-yaml');
34

45
module.exports = function (handle) {
56
return through.obj(function (file, enc, cb) {
67
if (file.isNull()) return cb();
78
if (file.isStream()) return this.emit('error', new gutil.PluginError('VM-json', 'Stream is not supported.'));
89
handle = handle || (i => i);
9-
file.contents = new Buffer(JSON.stringify(handle(JSON.parse(String(file.contents)))));
10+
let contents = String(file.contents);
11+
if (file.relative.toLowerCase().endsWith('.yml')) {
12+
contents = yaml.safeLoad(contents);
13+
file.path = file.path.slice(0, -4) + '.json';
14+
} else {
15+
contents = JSON.parse(contents);
16+
}
17+
file.contents = new Buffer(JSON.stringify(handle(contents)));
1018
cb(null, file);
1119
});
1220
};

src/background/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,6 @@ vmdb.initialized.then(function () {
311311
sync.init();
312312
});
313313

314-
_.mx.rt.icon.setIconImage('icon' + (_.options.get('isApplied') ? '' : 'w'));
314+
_.setIcon('icon' + (_.options.get('isApplied') ? '' : 'w'));
315315

316316
tabsUtils.on('TAB_SWITCH', badges.get);

src/common.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ _.mx = {
3838
};
3939
_.mx.br = _.mx.rt.create('mx.browser');
4040

41+
_.setIcon = function (icon) {
42+
// Initialize on first call
43+
function setIcon(icon) {
44+
_.mx.rt.icon.setIconImage(icon);
45+
tIcon && tIcon.setIconImage(icon);
46+
}
47+
var ui = _.mx.rt.create('mx.app.ui');
48+
var tIcon = ui && ui.getEntryPointByActionName && ui.getEntryPointByActionName('icon', 'toolbar');
49+
_.setIcon = setIcon;
50+
setIcon(icon);
51+
};
52+
4153
_.i18n = function (key) {
4254
if (!key) return '';
4355
var data = _.mx.rt.locale.t(key);

src/def.json

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/def.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
- type: extension
2+
frameworkVersion: 1.0.6
3+
version: __VERSION__
4+
guid: '{7732dc50-47c1-9be5-6ea9-f85c38172974}'
5+
author:
6+
name: Gerald
7+
8+
name: Violentmonkey
9+
title:
10+
_t: extName
11+
description:
12+
_t: extDescription
13+
permissions:
14+
httpRequest:
15+
- '*'
16+
notifications: true
17+
config: options/index.html
18+
service:
19+
main: background/index.html
20+
actions:
21+
- type: script
22+
entryPoints:
23+
- doc_start
24+
js:
25+
- injected.js
26+
includeFrames: true
27+
- name: icon
28+
type: panel
29+
icon: iconw
30+
entryPoints:
31+
- sidebar
32+
- toolbar
33+
main: popup/index.html

src/locale/cs-cz.yml

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ extDescription:
66
message: Podpora uživatelských skriptů pro Maxthon.
77
extTranslator:
88
description: Information of the translator.
9-
message: 'R3gi <[email protected]>'
9+
message: R3gi <[email protected]>
1010
touched: false
1111
msgUpdated:
1212
description: Message shown when a script is updated/reinstalled.
1313
message: Skript aktualizován.
1414
msgErrorFetchingScript:
1515
description: Message shown when Violentmonkey fails fetching a new version of the script.
16-
message: 'Chyba načítání skriptů!'
16+
message: Chyba načítání skriptů!
1717
msgInstalled:
1818
description: Message shown when a script is installed.
1919
message: Skript nainstalován.
@@ -22,15 +22,19 @@ Warning:
2222
message: Varování
2323
msgWarnGrant:
2424
description: Message shown when `@grant` is not found in a script.
25-
message: 'Skript [$1] nemá žádné „@grant“ řádky, což není doporučeno a může způsobovat problémy. Pro více informací klepněte sem.'
25+
message: >-
26+
Skript [$1] nemá žádné „@grant“ řádky, což není doporučeno a může způsobovat
27+
problémy. Pro více informací klepněte sem.
2628
labelNoName:
2729
description: Text as the name of a script when no @name is assigned.
2830
message: Bez názvu
2931
msgUpdating:
3032
description: Message shown when a new version of script is being fetched.
3133
message: Aktualizování…
3234
msgNewVersion:
33-
description: 'Message shown when a new version of script is found by @updateURL, but no @downloadURL is provided.'
35+
description: >-
36+
Message shown when a new version of script is found by @updateURL, but no
37+
@downloadURL is provided.
3438
message: Nalezena nová verze.
3539
msgCheckingForUpdate:
3640
description: Message shown when a script is being checked for updates by version numbers.
@@ -60,10 +64,14 @@ buttonClose:
6064
description: Button to close window.
6165
message: Zavřít
6266
msgErrorLoadingData:
63-
description: Message shown on confirm page when the script to be installed cannot be loaded.
67+
description: >-
68+
Message shown on confirm page when the script to be installed cannot be
69+
loaded.
6470
message: Chyba načítání skriptu.
6571
msgLoadedData:
66-
description: Message shown in the confirm page when a javascript file to be installed is loaded.
72+
description: >-
73+
Message shown in the confirm page when a javascript file to be installed is
74+
loaded.
6775
message: Skript načten.
6876
msgErrorLoadingDependency:
6977
description: Message shown when not all requirements are loaded successfully.
@@ -146,7 +154,9 @@ labelRelated:
146154
message: 'Související odkazy: '
147155
anchorSupportPage:
148156
description: Link to the support page of Violentmonkey.
149-
message: '<a href=https://github.com/gera2ld/Violentmonkey-mx/wiki target=_blank>Violentmonkey</a>'
157+
message: >-
158+
<a href=https://github.com/gera2ld/Violentmonkey-mx/wiki
159+
target=_blank>Violentmonkey</a>
150160
labelDonate:
151161
description: Label of link to donate page.
152162
message: Podpořte vývoj
@@ -251,7 +261,9 @@ buttonUpdate:
251261
description: Check a script for updates.
252262
message: Zkontrolovat aktualizace
253263
msgImported:
254-
description: Message shown after import. There is an argument referring to the count of scripts imported.
264+
description: >-
265+
Message shown after import. There is an argument referring to the count of
266+
scripts imported.
255267
message: 'Počet importovaných položek: $1'
256268
hintUseDownloadURL:
257269
description: Shown as a place holder for @updateURL when it is not assigned
@@ -269,7 +281,9 @@ buttonVacuumed:
269281
message: Data vyluxována
270282
hintVacuum:
271283
description: Hint for vacuuming data.
272-
message: Zlikvidování redudance a pokus o znovu načtení chybějících zdrojů z mezipaměti.
284+
message: >-
285+
Zlikvidování redudance a pokus o znovu načtení chybějících zdrojů z
286+
mezipaměti.
273287
menuManageScripts:
274288
description: 'Menu item to manage scripts, or to open the options page of the extension.'
275289
message: Správa skriptů
@@ -312,26 +326,33 @@ labelAutoReloadCurrentTab:
312326
labelInjectMode:
313327
description: Label for a combo box to choose script injection modes.
314328
message: ''
329+
touched: false
315330
injectModeNormal:
316331
description: 'Script injection mode: Normal'
317332
message: ''
333+
touched: false
318334
injectModeAdvanced:
319335
description: 'Script injection mode: Advanced'
320336
message: ''
337+
touched: false
321338
hintInjectModeNormal:
322339
description: Hint to explain the normal injection mode.
323340
message: ''
341+
touched: false
324342
hintInjectModeAdvanced:
325343
description: Hint to explain the advanced injection mode.
326344
message: ''
345+
touched: false
327346
hintInputURL:
328347
description: Hint for a prompt box to input URL of a user script.
329348
message: ''
330349
buttonInstallFromURL:
331350
description: Button to ask for URL of a user script.
332351
message: ''
333352
msgNamespaceConflict:
334-
description: Message shown when namespace of the new script conflicts with an existent one.
353+
description: >-
354+
Message shown when namespace of the new script conflicts with an existent
355+
one.
335356
message: ''
336357
labelSyncTo:
337358
description: Label for sync service.
@@ -366,3 +387,9 @@ lastSync:
366387
labelSync:
367388
description: Label for sync options.
368389
message: ''
390+
msgInvalidScript:
391+
description: Message shown when script is invalid.
392+
message: ''
393+
menuScriptDisabled:
394+
description: 'Menu item showing the status of Violentmonkey, when disabled.'
395+
message: ''

0 commit comments

Comments
 (0)