Add reloadOnDomMutation function

This commit is contained in:
the1812 2018-09-19 19:20:56 +08:00
parent 95cd64cf77
commit 73df542483
5 changed files with 35 additions and 11 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name Bilibili Evolved (Preview)
// @version 1.3.13
// @version 1.3.14
// @description 增强哔哩哔哩Web端体验. (预览版分支)
// @author Grant Howard
// @match *://*.bilibili.com/*
@ -49,7 +49,7 @@
notifyNewVersion: true,
fixFullscreen: false,
latestVersionLink: "https://github.com/the1812/Bilibili-Evolved/raw/preview/bilibili-evolved.preview.user.js",
currentVersion: "1.3.13"
currentVersion: "1.3.14"
};
function loadSettings()
{
@ -76,6 +76,12 @@
GM_addValueChangeListener(key, change);
}
}
function reloadOnDomMutation(selector, callback)
{
const element = document.querySelectorAll(selector);
const observer = new MutationObserver(callback);
observer.observe(element);
}
function loadResources()
{
Resource.root = "https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/";

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name Bilibili Evolved
// @version 1.3.13
// @version 1.3.14
// @description 增强哔哩哔哩Web端体验.
// @author Grant Howard
// @match *://*.bilibili.com/*
@ -49,7 +49,7 @@
notifyNewVersion: true,
fixFullscreen: false,
latestVersionLink: "https://github.com/the1812/Bilibili-Evolved/raw/master/bilibili-evolved.user.js",
currentVersion: "1.3.13"
currentVersion: "1.3.14"
};
function loadSettings()
{
@ -76,6 +76,12 @@
GM_addValueChangeListener(key, change);
}
}
function reloadOnDomMutation(selector, callback)
{
const element = document.querySelectorAll(selector);
const observer = new MutationObserver(callback);
observer.observe(element);
}
function loadResources()
{
Resource.root = "https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/";

View File

@ -1 +1 @@
1.3.13
1.3.14