hexo-adsense 1.0.26 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE +0 -0
  3. package/dist/index.cjs +757 -0
  4. package/dist/index.d.cts +2 -0
  5. package/dist/index.d.mts +2 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +740 -0
  8. package/dist/index.mjs +740 -0
  9. package/dist/source/adblock.css +2 -0
  10. package/{lib → dist}/source/adblock.js +0 -0
  11. package/{lib → dist}/source/article-ads.css +0 -0
  12. package/dist/source/article-ads.js +1 -0
  13. package/{lib/source/article-ads.js → dist/source/article-ads.old.js} +0 -0
  14. package/{lib → dist}/source/blogger-redirect.html +0 -0
  15. package/{lib → dist}/source/https.js +0 -0
  16. package/{lib → dist}/source/in_article_ads_test.html +0 -0
  17. package/package.json +122 -37
  18. package/{README.md → readme.md} +29 -11
  19. package/lib/index.d.ts +0 -1
  20. package/lib/index.js +0 -85
  21. package/lib/packages/hexo-cli-extras/lib/env.d.ts +0 -3
  22. package/lib/packages/hexo-cli-extras/lib/env.js +0 -49
  23. package/lib/packages/hexo-extend-injector2/index.d.ts +0 -2
  24. package/lib/packages/hexo-extend-injector2/index.js +0 -12
  25. package/lib/packages/hexo-extend-injector2/lib/bundle/css-bundle.d.ts +0 -2
  26. package/lib/packages/hexo-extend-injector2/lib/bundle/css-bundle.js +0 -64
  27. package/lib/packages/hexo-extend-injector2/lib/bundle/css-generator.d.ts +0 -2
  28. package/lib/packages/hexo-extend-injector2/lib/bundle/css-generator.js +0 -12
  29. package/lib/packages/hexo-extend-injector2/lib/bundle/handle-data-pre.d.ts +0 -2
  30. package/lib/packages/hexo-extend-injector2/lib/bundle/handle-data-pre.js +0 -28
  31. package/lib/packages/hexo-extend-injector2/lib/bundle/js-bundle.d.ts +0 -2
  32. package/lib/packages/hexo-extend-injector2/lib/bundle/js-bundle.js +0 -32
  33. package/lib/packages/hexo-extend-injector2/lib/bundle/js-generator.d.ts +0 -2
  34. package/lib/packages/hexo-extend-injector2/lib/bundle/js-generator.js +0 -8
  35. package/lib/packages/hexo-extend-injector2/lib/default-config.d.ts +0 -39
  36. package/lib/packages/hexo-extend-injector2/lib/default-config.js +0 -46
  37. package/lib/packages/hexo-extend-injector2/lib/filter.d.ts +0 -2
  38. package/lib/packages/hexo-extend-injector2/lib/filter.js +0 -22
  39. package/lib/packages/hexo-extend-injector2/lib/helper/injector.d.ts +0 -2
  40. package/lib/packages/hexo-extend-injector2/lib/helper/injector.js +0 -5
  41. package/lib/packages/hexo-extend-injector2/lib/helper/next-inject.d.ts +0 -2
  42. package/lib/packages/hexo-extend-injector2/lib/helper/next-inject.js +0 -12
  43. package/lib/packages/hexo-extend-injector2/lib/injector.d.ts +0 -29
  44. package/lib/packages/hexo-extend-injector2/lib/injector.js +0 -125
  45. package/lib/packages/hexo-extend-injector2/lib/load.d.ts +0 -3
  46. package/lib/packages/hexo-extend-injector2/lib/load.js +0 -37
  47. package/lib/packages/hexo-extend-injector2/lib/next-point.d.ts +0 -2
  48. package/lib/packages/hexo-extend-injector2/lib/next-point.js +0 -18
  49. package/lib/packages/hexo-extend-injector2/lib/next.d.ts +0 -2
  50. package/lib/packages/hexo-extend-injector2/lib/next.js +0 -99
  51. package/lib/packages/hexo-extend-injector2/lib/order.d.ts +0 -5
  52. package/lib/packages/hexo-extend-injector2/lib/order.js +0 -8
  53. package/lib/source/adblock.css +0 -2
  54. package/lib/src/article-ads.d.ts +0 -20
  55. package/lib/src/article-ads.js +0 -304
  56. package/lib/src/checkLocalHost.d.ts +0 -10
  57. package/lib/src/checkLocalHost.js +0 -37
  58. package/lib/src/config.d.ts +0 -13
  59. package/lib/src/config.js +0 -42
  60. package/lib/src/html-parser.d.ts +0 -9
  61. package/lib/src/html-parser.js +0 -26
  62. package/lib/src/log.d.ts +0 -1
  63. package/lib/src/log.js +0 -11
  64. package/lib/src/logger.d.ts +0 -3
  65. package/lib/src/logger.js +0 -25
  66. package/lib/src/md5.d.ts +0 -2
  67. package/lib/src/md5.js +0 -165
  68. package/lib/src/safestringify.d.ts +0 -2
  69. package/lib/src/safestringify.js +0 -125
  70. package/lib/src/utils.d.ts +0 -31
  71. package/lib/src/utils.js +0 -159
  72. package/lib/src/versionParser.d.ts +0 -27
  73. package/lib/src/versionParser.js +0 -40
  74. package/packages/hexo-cli-extras/.eslintrc +0 -13
  75. package/packages/hexo-cli-extras/LICENSE.md +0 -20
  76. package/packages/hexo-cli-extras/README.md +0 -146
  77. package/packages/hexo-cli-extras/docs/basic.gif +0 -0
  78. package/packages/hexo-cli-extras/docs/gui.gif +0 -0
  79. package/packages/hexo-cli-extras/docs/remove.png +0 -0
  80. package/packages/hexo-cli-extras/docs/rename.png +0 -0
  81. package/packages/hexo-cli-extras/index.js +0 -48
  82. package/packages/hexo-cli-extras/lib/edit.js +0 -209
  83. package/packages/hexo-cli-extras/lib/env.js +0 -52
  84. package/packages/hexo-cli-extras/lib/extensions.js +0 -23
  85. package/packages/hexo-cli-extras/lib/integrate.js +0 -87
  86. package/packages/hexo-cli-extras/lib/isolate.js +0 -179
  87. package/packages/hexo-cli-extras/lib/remove.js +0 -145
  88. package/packages/hexo-cli-extras/lib/rename.js +0 -171
  89. package/packages/hexo-cli-extras/package.json +0 -34
  90. package/packages/hexo-extend-injector2/.eslintrc +0 -4
  91. package/packages/hexo-extend-injector2/.github/workflows/linter.yml +0 -27
  92. package/packages/hexo-extend-injector2/.github/workflows/tester.yml +0 -24
  93. package/packages/hexo-extend-injector2/.vscode/settings.json +0 -10
  94. package/packages/hexo-extend-injector2/LICENSE +0 -165
  95. package/packages/hexo-extend-injector2/README-ZH.md +0 -189
  96. package/packages/hexo-extend-injector2/README.md +0 -191
  97. package/packages/hexo-extend-injector2/USAGE.md +0 -38
  98. package/packages/hexo-extend-injector2/index.js +0 -14
  99. package/packages/hexo-extend-injector2/lib/bundle/css-bundle.js +0 -79
  100. package/packages/hexo-extend-injector2/lib/bundle/css-generator.js +0 -13
  101. package/packages/hexo-extend-injector2/lib/bundle/handle-data-pre.js +0 -29
  102. package/packages/hexo-extend-injector2/lib/bundle/js-bundle.js +0 -42
  103. package/packages/hexo-extend-injector2/lib/bundle/js-generator.js +0 -10
  104. package/packages/hexo-extend-injector2/lib/default-config.js +0 -52
  105. package/packages/hexo-extend-injector2/lib/filter.js +0 -24
  106. package/packages/hexo-extend-injector2/lib/helper/injector.js +0 -6
  107. package/packages/hexo-extend-injector2/lib/helper/next-inject.js +0 -14
  108. package/packages/hexo-extend-injector2/lib/injector.js +0 -128
  109. package/packages/hexo-extend-injector2/lib/load.js +0 -45
  110. package/packages/hexo-extend-injector2/lib/next-point.js +0 -19
  111. package/packages/hexo-extend-injector2/lib/next.js +0 -87
  112. package/packages/hexo-extend-injector2/lib/order.js +0 -9
  113. package/packages/hexo-extend-injector2/package.json +0 -49
  114. package/packages/hexo-extend-injector2/renovate.json +0 -6
  115. package/packages/hexo-extend-injector2/test/.eslintrc +0 -3
  116. package/packages/hexo-extend-injector2/test/index.js +0 -18
  117. package/packages/hexo-extend-injector2/test/lib/bundle/bundle-css.js +0 -86
  118. package/packages/hexo-extend-injector2/test/lib/bundle/bundle-js.js +0 -36
  119. package/packages/hexo-extend-injector2/test/lib/bundle/test.css +0 -3
  120. package/packages/hexo-extend-injector2/test/lib/bundle/test.js +0 -5
  121. package/packages/hexo-extend-injector2/test/lib/helper/injector.js +0 -45
  122. package/packages/hexo-extend-injector2/test/lib/helper/next-inject.js +0 -69
  123. package/packages/hexo-extend-injector2/test/lib/hexo-compatible.js +0 -250
  124. package/packages/hexo-extend-injector2/test/lib/hexo-injector.js +0 -37
  125. package/packages/hexo-extend-injector2/test/lib/injector.js +0 -93
  126. package/packages/memoize/CHANGELOG.md +0 -82
  127. package/packages/memoize/CHANGES +0 -124
  128. package/packages/memoize/LICENSE +0 -15
  129. package/packages/memoize/README.md +0 -503
  130. package/packages/memoize/ext/async.js +0 -154
  131. package/packages/memoize/ext/dispose.js +0 -33
  132. package/packages/memoize/ext/max-age.js +0 -90
  133. package/packages/memoize/ext/max.js +0 -27
  134. package/packages/memoize/ext/promise.js +0 -147
  135. package/packages/memoize/ext/ref-counter.js +0 -48
  136. package/packages/memoize/index.js +0 -34
  137. package/packages/memoize/lib/configure-map.js +0 -182
  138. package/packages/memoize/lib/methods.js +0 -32
  139. package/packages/memoize/lib/registered-extensions.js +0 -1
  140. package/packages/memoize/lib/resolve-length.js +0 -15
  141. package/packages/memoize/lib/resolve-normalize.js +0 -17
  142. package/packages/memoize/lib/resolve-resolve.js +0 -21
  143. package/packages/memoize/lib/weak.js +0 -134
  144. package/packages/memoize/methods-plain.js +0 -3
  145. package/packages/memoize/methods.js +0 -3
  146. package/packages/memoize/normalizers/get-1.js +0 -29
  147. package/packages/memoize/normalizers/get-fixed.js +0 -71
  148. package/packages/memoize/normalizers/get-primitive-fixed.js +0 -16
  149. package/packages/memoize/normalizers/get.js +0 -90
  150. package/packages/memoize/normalizers/primitive.js +0 -9
  151. package/packages/memoize/package.json +0 -60
  152. package/packages/memoize/plain.js +0 -37
  153. package/packages/memoize/profile.js +0 -107
  154. package/packages/memoize/repository.md +0 -1
  155. package/packages/memoize/weak-plain.js +0 -3
  156. package/packages/memoize/weak.js +0 -3
  157. package/unused.md +0 -12
@@ -1,8 +0,0 @@
1
- 'use strict';
2
- var minify = require('terser').minify;
3
- module.exports = function (injector, options) { return function () {
4
- return Promise.all(injector.get('js').toPromise())
5
- .then(function (values) { return values.join('\n'); })
6
- .then(function (source) { return minify(source, options); })
7
- .then(function (result) { return result.code; });
8
- }; };
@@ -1,39 +0,0 @@
1
- export const disable_default_point: boolean;
2
- export const injector_point_headbegin: boolean;
3
- export const injector_point_headend: boolean;
4
- export const injector_point_bodybegin: boolean;
5
- export const injector_point_bodyend: boolean;
6
- export const load_next_compatible: boolean;
7
- export const load_next_plugin: boolean;
8
- export namespace js {
9
- const enable: boolean;
10
- const path: string;
11
- const options: {};
12
- }
13
- export namespace css {
14
- const enable_1: boolean;
15
- export { enable_1 as enable };
16
- export namespace path_1 {
17
- namespace _default {
18
- const path_2: string;
19
- export { path_2 as path };
20
- export const link: string;
21
- }
22
- export { _default as default };
23
- export namespace dark {
24
- const path_3: string;
25
- export { path_3 as path };
26
- const link_1: string;
27
- export { link_1 as link };
28
- }
29
- export namespace light {
30
- const path_4: string;
31
- export { path_4 as path };
32
- const link_2: string;
33
- export { link_2 as link };
34
- }
35
- }
36
- export { path_1 as path };
37
- const options_1: {};
38
- export { options_1 as options };
39
- }
@@ -1,46 +0,0 @@
1
- 'use strict';
2
- module.exports = {
3
- /**
4
- * Injector Point
5
- * If helper used, it will set injector_point_<key> to true
6
- */
7
- disable_default_point: false,
8
- injector_point_headbegin: false,
9
- injector_point_headend: false,
10
- injector_point_bodybegin: false,
11
- injector_point_bodyend: false,
12
- /**
13
- * NexT Plugin
14
- */
15
- load_next_compatible: true,
16
- load_next_plugin: true,
17
- /**
18
- * Js bundler config, use terser
19
- */
20
- js: {
21
- enable: true,
22
- path: 'js/injector.js',
23
- options: {}
24
- },
25
- /**
26
- * CSS bundler config, use clean css
27
- */
28
- css: {
29
- enable: true,
30
- path: {
31
- "default": {
32
- path: 'css/injector/main.css',
33
- link: 'load'
34
- },
35
- dark: {
36
- path: 'css/injector/dark.css',
37
- link: 'preload'
38
- },
39
- light: {
40
- path: 'css/injector/light.css',
41
- link: 'preload'
42
- }
43
- },
44
- options: {}
45
- }
46
- };
@@ -1,2 +0,0 @@
1
- export = injectFilter;
2
- declare function injectFilter(injector: any): (data: any, locals: any) => any;
@@ -1,22 +0,0 @@
1
- 'use strict';
2
- var injectFilter = function (injector) { return function (data, locals) {
3
- function inject(data, pattern, flag, isBegin) {
4
- if (isBegin === void 0) { isBegin = true; }
5
- if (injector.config["injector_point_" + injector.formatKey(flag)])
6
- return data;
7
- var code = injector.get(flag, { context: locals }).text();
8
- if (!code.length)
9
- return data;
10
- return data.replace(pattern, function (str) { return isBegin ? str + code : code + str; });
11
- }
12
- // Inject head_begin
13
- data = inject(data, /<head.*?>/, 'head_begin', true);
14
- // Inject head_end
15
- data = inject(data, '</head>', 'head_end', false);
16
- // Inject body_begin
17
- data = inject(data, /<body.*?>/, 'body_begin', true);
18
- // Inject body_end
19
- data = inject(data, '</body>', 'body_end', false);
20
- return data;
21
- }; };
22
- module.exports = injectFilter;
@@ -1,2 +0,0 @@
1
- declare function _exports(injector: any, ctx: any): (point: any) => any;
2
- export = _exports;
@@ -1,5 +0,0 @@
1
- 'use strict';
2
- module.exports = function (injector, ctx) { return function (point) {
3
- injector.config["injector_point_" + injector.formatKey(point)] = true;
4
- return injector.get(point, { context: ctx });
5
- }; };
@@ -1,2 +0,0 @@
1
- declare function _exports(injector: any, ctx: any): (point: any) => any;
2
- export = _exports;
@@ -1,12 +0,0 @@
1
- 'use strict';
2
- var injectorHelper = require('./injector');
3
- module.exports = function (injector, ctx) { return function (point) {
4
- var nextInject = ctx.theme.injects[point]
5
- .map(function (item) { return ctx.partial(item.layout, item.locals, item.options); })
6
- .join('');
7
- var injector2 = injectorHelper(injector, ctx)(point).text();
8
- if (point === 'head') {
9
- injector2 += injectorHelper(injector, ctx)('head-end').text();
10
- }
11
- return nextInject + injector2;
12
- }; };
@@ -1,29 +0,0 @@
1
- export = Injector;
2
- declare class Injector {
3
- constructor(ctx: any);
4
- _store: {};
5
- _run: {};
6
- _ctx: any;
7
- order: {
8
- REGISTER_NEXT_HELPER: number;
9
- REGISTER_VARIABLE: number;
10
- REGISTER_STYLE: number;
11
- REGISTER_JS: number;
12
- REGISTER_CSS: number;
13
- };
14
- config: any;
15
- clean(): void;
16
- get(entry: any, options: any): {
17
- list: () => any[];
18
- rendered: () => any[];
19
- text: (sep?: string) => string;
20
- toPromise: () => Promise<any>[];
21
- };
22
- getSize(entry: any): any;
23
- register(entry: any, value: any, predicate: () => boolean, priority: number, isRun: any): Injector;
24
- is(...types: any[]): (locals: any) => boolean;
25
- formatKey(entry: any): any;
26
- registerDefaultPoint(): void;
27
- registerHelper(): void;
28
- registerNexTHelper(): void;
29
- }
@@ -1,125 +0,0 @@
1
- 'use strict';
2
- var order = require('./order');
3
- var defaultConfig = require('./default-config');
4
- var mergeWith = require('lodash').mergeWith;
5
- // const { join } = require('path');
6
- // const { readFileSync } = require('fs');
7
- var Injector = /** @class */ (function () {
8
- function Injector(ctx) {
9
- this._store = {};
10
- this._run = {};
11
- this._ctx = ctx;
12
- this.order = order;
13
- this.config = mergeWith(defaultConfig, ctx.config.injector, function (objValue, srcValue) {
14
- if (Array.isArray(objValue)) {
15
- return srcValue;
16
- }
17
- });
18
- }
19
- Injector.prototype.clean = function () {
20
- this._run = {};
21
- };
22
- Injector.prototype.get = function (entry, options) {
23
- entry = this.formatKey(entry);
24
- options = Object.assign({ context: this._ctx }, options);
25
- var ctx = options.context;
26
- var _storeEntries = Array.from(this._store[entry] || []);
27
- var _runEntries = Array.from(this._run[entry] || []);
28
- var list = function () { return _storeEntries.concat(_runEntries)
29
- .filter(function (item) { return item.predicate(ctx, options); })
30
- .sort(function (a, b) { return a.priority - b.priority; }); };
31
- var rendered = function () { return list()
32
- .map(function (item) {
33
- var renderItem = Object.assign({}, item);
34
- if (typeof item.value === 'function') {
35
- renderItem.value = item.value(ctx, options);
36
- }
37
- return renderItem;
38
- }); };
39
- var text = function (sep) {
40
- if (sep === void 0) { sep = ''; }
41
- return rendered()
42
- .map(function (item) { return item.value; })
43
- .join(sep);
44
- };
45
- var toPromise = function () { return rendered()
46
- .map(function (item) { return Promise.resolve(item.value); }); };
47
- return { list: list, rendered: rendered, text: text, toPromise: toPromise };
48
- };
49
- Injector.prototype.getSize = function (entry) {
50
- entry = this.formatKey(entry);
51
- var storeLen = this._store[entry] ? this._store[entry].length : 0;
52
- var runLen = this._run[entry] ? this._run[entry].length : 0;
53
- return storeLen + runLen;
54
- };
55
- Injector.prototype.register = function (entry, value, predicate, priority, isRun) {
56
- if (predicate === void 0) { predicate = function () { return true; }; }
57
- if (priority === void 0) { priority = 10; }
58
- if (!entry)
59
- throw new TypeError('entry is required');
60
- entry = this.formatKey(entry);
61
- if (typeof value !== 'object') {
62
- value = { value: value };
63
- }
64
- var options = Object.assign({ predicate: predicate, priority: priority, isRun: isRun }, value);
65
- var store = options.isRun ? this._run : this._store;
66
- store[entry] = store[entry] || [];
67
- if (typeof options.predicate === 'string') {
68
- options.predicate = this.is(options.predicate);
69
- }
70
- this._ctx.execFilterSync('injector2:register', options, { args: [entry] });
71
- this._ctx.execFilterSync("injector2:register-" + entry, options);
72
- store[entry].push(options);
73
- return this;
74
- };
75
- Injector.prototype.is = function () {
76
- var types = [];
77
- for (var _i = 0; _i < arguments.length; _i++) {
78
- types[_i] = arguments[_i];
79
- }
80
- return function (locals) {
81
- for (var _i = 0, types_1 = types; _i < types_1.length; _i++) {
82
- var type = types_1[_i];
83
- if (type === 'home' && locals.page.__index)
84
- return true;
85
- if (type === 'post' && locals.page.__post)
86
- return true;
87
- if (type === 'page' && locals.page.__page)
88
- return true;
89
- if (type === 'archive' && locals.page.archive)
90
- return true;
91
- if (type === 'category' && locals.page.category)
92
- return true;
93
- if (type === 'tag' && locals.page.tag)
94
- return true;
95
- if (locals.page[type])
96
- return true;
97
- }
98
- return false;
99
- };
100
- };
101
- Injector.prototype.formatKey = function (entry) {
102
- return entry.replace(/[-| |_]/g, '').toLowerCase();
103
- };
104
- Injector.prototype.registerDefaultPoint = function () {
105
- var filter = this._ctx.extend.filter;
106
- filter.register('_after_html_render', require('./filter')(this));
107
- };
108
- Injector.prototype.registerHelper = function () {
109
- var self = this;
110
- var helper = this._ctx.extend.helper;
111
- helper.register('injector', function (point) {
112
- return require('./helper/injector')(self, this)(point);
113
- });
114
- };
115
- Injector.prototype.registerNexTHelper = function () {
116
- // 为了能覆盖主题中的注册,请在after_init中调用
117
- var self = this;
118
- var helper = this._ctx.extend.helper;
119
- helper.register('next_inject', function (point) {
120
- return require('./helper/next-inject')(self, this)(point);
121
- });
122
- };
123
- return Injector;
124
- }());
125
- module.exports = Injector;
@@ -1,3 +0,0 @@
1
- export = loadInjector;
2
- declare function loadInjector(ctx: any): Injector;
3
- import Injector = require("./injector");
@@ -1,37 +0,0 @@
1
- 'use strict';
2
- var Injector = require('./injector');
3
- var join = require('path').join;
4
- var readFileSync = require('fs').readFileSync;
5
- var loadInjector = function (ctx) {
6
- var filter = ctx.extend.filter;
7
- // Init injector
8
- var injector = new Injector(ctx);
9
- ctx.extend.injector2 = injector;
10
- ctx.on('generateBefore', function () {
11
- injector.clean();
12
- });
13
- injector.registerHelper();
14
- var order = injector.order, config = injector.config;
15
- if (!config.disable_default_point) {
16
- injector.registerDefaultPoint();
17
- }
18
- // Load next plugin
19
- var themeD = JSON.parse(readFileSync(join(ctx.theme_dir, 'package.json'), 'utf-8'));
20
- if (themeD.name === 'hexo-theme-next') {
21
- if (config.load_next_compatible) {
22
- filter.register('after_init', function () {
23
- injector.registerNexTHelper();
24
- }, order.REGISTER_NEXT_HELPER);
25
- }
26
- }
27
- else {
28
- if (config.load_next_plugin) {
29
- require('./next')(ctx, injector);
30
- }
31
- }
32
- // Build js and css bundler
33
- require('./bundle/js-bundle')(ctx, injector);
34
- require('./bundle/css-bundle')(ctx, injector);
35
- return injector;
36
- };
37
- module.exports = loadInjector;
@@ -1,2 +0,0 @@
1
- export const views: string[];
2
- export const styles: string[];
@@ -1,18 +0,0 @@
1
- 'use strict';
2
- module.exports = {
3
- views: [
4
- 'head',
5
- 'header',
6
- 'sidebar',
7
- 'postMeta',
8
- 'postBodyEnd',
9
- 'footer',
10
- 'bodyEnd',
11
- 'comment'
12
- ],
13
- styles: [
14
- 'variable',
15
- 'mixin',
16
- 'style'
17
- ]
18
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(ctx: any, injector: any): void;
2
- export = _exports;
@@ -1,99 +0,0 @@
1
- 'use strict';
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
- /**
12
- * Compatible with next theme injector
13
- */
14
- var points = require('./next-point');
15
- var fs = require('fs');
16
- var path = require('path');
17
- var defaultExtname = '.swig';
18
- // Defining stylus types
19
- var StylusInject = /** @class */ (function () {
20
- function StylusInject(base_dir) {
21
- this.base_dir = base_dir;
22
- this.files = [];
23
- }
24
- StylusInject.prototype.push = function (file) {
25
- // Get absolute path base on hexo dir
26
- this.files.push(path.resolve(this.base_dir, file));
27
- };
28
- return StylusInject;
29
- }());
30
- // Defining view types
31
- var ViewInject = /** @class */ (function () {
32
- function ViewInject(base_dir) {
33
- this.base_dir = base_dir;
34
- this.raws = [];
35
- }
36
- ViewInject.prototype.raw = function (name, raw) {
37
- var args = [];
38
- for (var _i = 2; _i < arguments.length; _i++) {
39
- args[_i - 2] = arguments[_i];
40
- }
41
- // Set default extname
42
- if (path.extname(name) === '') {
43
- name += defaultExtname;
44
- }
45
- this.raws.push({ name: name, raw: raw, args: args });
46
- };
47
- ViewInject.prototype.file = function (name, file) {
48
- var args = [];
49
- for (var _i = 2; _i < arguments.length; _i++) {
50
- args[_i - 2] = arguments[_i];
51
- }
52
- // Set default extname from file's extname
53
- if (path.extname(name) === '') {
54
- name += path.extname(file);
55
- }
56
- // Get absolute path base on hexo dir
57
- this.raw.apply(this, __spreadArray([name, fs.readFileSync(path.resolve(this.base_dir, file), 'utf8')], args, false));
58
- };
59
- return ViewInject;
60
- }());
61
- // Init injects
62
- function initInject(base_dir) {
63
- var injects = {};
64
- points.styles.forEach(function (item) {
65
- injects[item] = new StylusInject(base_dir);
66
- });
67
- points.views.forEach(function (item) {
68
- injects[item] = new ViewInject(base_dir);
69
- });
70
- return injects;
71
- }
72
- module.exports = function (ctx, injector) {
73
- ctx.on('generateBefore', function () {
74
- var injects = initInject(ctx.base_dir);
75
- ctx.execFilterSync('theme_inject', injects);
76
- // stylus
77
- points.styles.forEach(function (type) {
78
- injects[type].files.forEach(function (file) { return injector.register(type, file, function () { return true; }, 10, true); });
79
- });
80
- // view
81
- points.views.forEach(function (type) {
82
- injects[type].raws
83
- .map(function (injectObj, index) {
84
- var name = injectObj.name;
85
- var layout = "inject/" + type + "/" + name;
86
- if (!ctx.theme.getView(layout)) {
87
- ctx.theme.setView(layout, injectObj.raw);
88
- }
89
- var locals = injectObj.args[0];
90
- var options = injectObj.args[1];
91
- var order = injectObj.args[2] || index;
92
- var value = function (ctx) { return ctx.partial(layout, locals, options); };
93
- return { value: value, priority: order, name: name, layout: layout, locals: locals, options: options, isRun: true };
94
- })
95
- .sort(function (a, b) { return b.priority - a.priority; })
96
- .forEach(function (data) { return injector.register(type, data); });
97
- });
98
- });
99
- };
@@ -1,5 +0,0 @@
1
- export const REGISTER_NEXT_HELPER: number;
2
- export const REGISTER_VARIABLE: number;
3
- export const REGISTER_STYLE: number;
4
- export const REGISTER_JS: number;
5
- export const REGISTER_CSS: number;
@@ -1,8 +0,0 @@
1
- 'use strict';
2
- module.exports = {
3
- REGISTER_NEXT_HELPER: -1000,
4
- REGISTER_VARIABLE: -1000,
5
- REGISTER_STYLE: 1000,
6
- REGISTER_JS: 1000,
7
- REGISTER_CSS: 1000
8
- };
@@ -1,2 +0,0 @@
1
- #levelmaxblock{background:rgba(20,20,20,.39);position:fixed;margin:auto;left:0;right:0;top:0;bottom:0;overflow:auto;z-index:999999}#levelmaxblock .header{margin:0 0 15px 0}#levelmaxblock .header h2{color:#222;font-size:1.5rem}#levelmaxblock .inner{background:#fff;color:#222;box-shadow:0 0 2rem -1rem rgba(0,0,0,.5);text-align:center;width:100%;max-width:640px;padding:30px;margin:7% auto 2% auto;-webkit-animation:fadeInDown 1s;animation:fadeInDown 1s}#levelmaxblock button{padding:10px 20px;border:0;background:#fff;color:#e74c3c;margin:20px 5px;cursor:pointer;border-radius:3px;font-size:13px;font-weight:600;border:2px solid #e74c3c;transition:initial}#levelmaxblock button:hover{background:#2c3e50;color:#fff;outline:0;border-color:#2c3e50}#levelmaxblock button.active,#levelmaxblock button:hover.active{background:#e74c3c;color:#fff;border-color:#e74c3c;outline:0}#levelmaxblock .caranya{background:#fff;text-align:left;color:#000;padding:20px;height:250px;overflow:auto;line-height:30px;border:1px solid rgba(0,0,0,.05)}#levelmaxblock .caranya div{display:none}#levelmaxblock .caranya div.active{display:block;-webkit-animation:fadeInUp .5s;animation:fadeInUp .5s}#levelmaxblock ol{margin-left:20px}@media (max-width:768px){#levelmaxblock .inner{width:calc(100% - 20px);margin:10px auto;padding:15px}}
2
- /*# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFkYmxvY2suY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLGVBQ0UsV0FBQSxtQkFDQSxTQUFBLE1BQ0EsT0FBQSxLQUNBLEtBQUEsRUFDQSxNQUFBLEVBQ0EsSUFBQSxFQUNBLE9BQUEsRUFDQSxTQUFBLEtBQ0EsUUFBQSxPQUVGLHVCQUNFLE9BQUEsRUFBQSxFQUFBLEtBQUEsRUFFRiwwQkFDRSxNQUFBLEtBQ0EsVUFBQSxPQUVGLHNCQUNFLFdBQUEsS0FDQSxNQUFBLEtBQ0EsV0FBQSxFQUFBLEVBQUEsS0FBQSxNQUFBLGVBQ0EsV0FBQSxPQUNBLE1BQUEsS0FDQSxVQUFBLE1BQ0EsUUFBQSxLQUNBLE9BQUEsR0FBQSxLQUFBLEdBQUEsS0FDQSxrQkFBQSxXQUFBLEdBQUEsVUFBQSxXQUFBLEdBRUYsc0JBQ0UsUUFBQSxLQUFBLEtBQ0EsT0FBQSxFQUNBLFdBQUEsS0FDQSxNQUFBLFFBQ0EsT0FBQSxLQUFBLElBQ0EsT0FBQSxRQUNBLGNBQUEsSUFDQSxVQUFBLEtBQ0EsWUFBQSxJQUNBL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GJsb2NrIC5jYXJhbnlhIHtcclxuICBiYWNrZ3JvdW5kOiAjZmZmO1xyXG4gIHRleHQtYWxpZ246IGxlZnQ7XHJcbiAgY29sb3I6ICMwMDA7XHJcbiAgcGFkZGluZzogMjBweDtcclxuICBoZWlnaHQ6IDI1MHB4O1xyXG4gIG92ZXJmbG93OiBhdXRvO1xyXG4gIGxpbmUtaGVpZ2h0OiAzMHB4O1xyXG4gIGJvcmRlcjogMXB4IHNvbGlkIHJnYmEoMCwgMCwgMCwgMC4wNSk7XHJcbn1cclxuI2xldmVsbWF4YmxvY2sgLmNhcmFueWEgZGl2IHtcclxuICBkaXNwbGF5OiBub25lO1xyXG59XHJcbiNsZXZlbG1heGJsb2NrIC5jYXJhbnlhIGRpdi5hY3RpdmUge1xyXG4gIGRpc3BsYXk6IGJsb2NrO1xyXG4gIGFuaW1hdGlvbjogZmFkZUluVXAgMC41cztcclxufVxyXG4jbGV2ZWxtYXhibG9jayBvbCB7XHJcbiAgbWFyZ2luLWxlZnQ6IDIwcHg7XHJcbn1cclxuQG1lZGlhIChtYXgtd2lkdGg6IDc2OHB4KSB7XHJcbiAgI2xldmVsbWF4YmxvY2sgLmlubmVyIHtcclxuICAgIHdpZHRoOiBjYWxjKDEwMCUgLSAyMHB4KTtcclxuICAgIG1hcmdpbjogMTBweCBhdXRvO1xyXG4gICAgcGFkZGluZzogMTVweDtcclxuICB9XHJcbn1cclxuIl19 */
@@ -1,20 +0,0 @@
1
- /**
2
- * Article ads reader
3
- * @param {string[]} files
4
- * @param {Hexo} hexo
5
- */
6
- declare function articleAds(files: string[], hexo: Hexo): string[];
7
- /**
8
- * Inject ads after_render:html event (on all page)
9
- * @param {object} data
10
- * @param {string} content
11
- */
12
- export function after_render_html(content: string, data: object): string;
13
- /**
14
- * inject ads after_post_render event
15
- * @example
16
- * hexo.extend.filter.register("after_generate", injectAdsAfterGenerate);
17
- */
18
- export function after_post_render(data: any): any;
19
- import Hexo = require("hexo");
20
- export { articleAds as endbodycode };