Add html tag function

This commit is contained in:
the1812 2019-10-10 18:34:50 +08:00
parent e76df573c8
commit bcc32fd77d
7 changed files with 33 additions and 2 deletions

View File

@ -408,6 +408,7 @@ declare global {
function dq(element: Element, selector: string): Element | null;
function dqa(selector: string): Element[];
function dqa(element: Element, selector: string): Element[];
function html(strings: TemplateStringsArray, ...values: unknown[]): string
const formatFileSize: (bytes: number, fixed?: number) => string
const formatDuration: (time: number, fixed?: number) => string
const ascendingSort: <T>(itemProp: (item: T) => number) => (a: T, b: T) => number

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name Bilibili Evolved (Offline)
// @version 450.72
// @version 451.12
// @description Bilibili Evolved 的离线版, 所有功能都已内置于脚本中.
// @author Grant Howard, Coulomb-G
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
@ -190,6 +190,12 @@ const formatCount = (count) => {
const escapeFilename = (filename, replacement = '') => {
return filename.replace(/[\/\\:\*\?"<>\|]/g, replacement)
}
function html(strings, ...values) {
return [...strings].reduce((previous, current, index) => {
const value = values[index]
return previous + current + (value === undefined ? '' : value)
}, '')
}
const customNavbarDefaultOrders = {
blank1: 0,

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name Bilibili Evolved (Preview Offline)
// @version 450.72
// @version 451.12
// @description Bilibili Evolved 的预览离线版, 可以抢先体验新功能, 并且所有功能都已内置于脚本中.
// @author Grant Howard, Coulomb-G
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
@ -190,6 +190,12 @@ const formatCount = (count) => {
const escapeFilename = (filename, replacement = '') => {
return filename.replace(/[\/\\:\*\?"<>\|]/g, replacement)
}
function html(strings, ...values) {
return [...strings].reduce((previous, current, index) => {
const value = values[index]
return previous + current + (value === undefined ? '' : value)
}, '')
}
const customNavbarDefaultOrders = {
blank1: 0,

View File

@ -189,6 +189,12 @@ const formatCount = (count) => {
const escapeFilename = (filename, replacement = '') => {
return filename.replace(/[\/\\:\*\?"<>\|]/g, replacement)
}
function html(strings, ...values) {
return [...strings].reduce((previous, current, index) => {
const value = values[index]
return previous + current + (value === undefined ? '' : value)
}, '')
}
const customNavbarDefaultOrders = {
blank1: 0,

View File

@ -189,6 +189,12 @@ const formatCount = (count) => {
const escapeFilename = (filename, replacement = '') => {
return filename.replace(/[\/\\:\*\?"<>\|]/g, replacement)
}
function html(strings, ...values) {
return [...strings].reduce((previous, current, index) => {
const value = values[index]
return previous + current + (value === undefined ? '' : value)
}, '')
}
const customNavbarDefaultOrders = {
blank1: 0,

Binary file not shown.

View File

@ -153,3 +153,9 @@ export const formatCount = (count) => {
export const escapeFilename = (filename, replacement = '') => {
return filename.replace(/[\/\\:\*\?"<>\|]/g, replacement)
}
export function html(strings, ...values) {
return [...strings].reduce((previous, current, index) => {
const value = values[index]
return previous + current + (value === undefined ? '' : value)
}, '')
}