Feature/#35 build tools #36
|
@ -1,6 +1,10 @@
|
|||
registerScript(node => {
|
||||
import * as core from '../utils/aniwatchCore';
|
||||
import * as color from '../utils/colors';
|
||||
import * as helper from '../utils/helpers';
|
||||
|
||||
core.registerScript(node => {
|
||||
// run the scripts
|
||||
if (isHtmlElement(node)) {
|
||||
if (helper.isHtmlElement(node)) {
|
||||
changeFollowedStarColor(node);
|
||||
changeBorderColorOwnRequests(node);
|
||||
removeUnknownUsers(node);
|
||||
|
@ -14,7 +18,7 @@ function changeFollowedStarColor(node) {
|
|||
let followedItems = Array.from(node.querySelectorAll('i')).filter(i => i.innerText.trim() === starIcon);
|
||||
|
||||
// change color
|
||||
followedItems.forEach(item => item.style.color = aniBlue);
|
||||
followedItems.forEach(item => item.style.color = color.aniBlue);
|
||||
}
|
||||
|
||||
function changeBorderColorOwnRequests(node) {
|
||||
|
@ -25,7 +29,7 @@ function changeBorderColorOwnRequests(node) {
|
|||
|
||||
// highlight left border for own request
|
||||
if (profileLink.length > 0) {
|
||||
item.style.borderColor = aniBlue
|
||||
item.style.borderColor = color.aniBlue
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
registerScript(node => {
|
||||
import * as core from '../utils/aniwatchCore';
|
||||
import * as helper from '../utils/helpers';
|
||||
|
||||
core.registerScript(node => {
|
||||
// run the scripts
|
||||
if (isHtmlElement(node)) {
|
||||
if (helper.isHtmlElement(node)) {
|
||||
addListHorizontalSeparators(node)
|
||||
}
|
||||
}, ".*");
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import * as core from '../utils/aniwatchCore';
|
||||
import * as helper from '../utils/helpers';
|
||||
|
||||
const quickSearchID = 'ea-quickSearch';
|
||||
const quickSearchLink = 'ea-quickSearchLink';
|
||||
|
||||
runAfterLoad(() => {
|
||||
core.runAfterLoad(() => {
|
||||
initSearch();
|
||||
}, ".*");
|
||||
|
||||
|
@ -58,7 +61,7 @@ function handleQuickSearch(event) {
|
|||
}
|
||||
|
||||
function handleSearchForShiftF(event) {
|
||||
if (isShiftPressed) {
|
||||
if (helper.isShiftPressed) {
|
||||
if (event.key === 'F') {
|
||||
event.preventDefault();
|
||||
document.getElementById(quickSearchID).focus();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
let __scripts = [];
|
||||
let __afterLoadScripts = [];
|
||||
|
||||
function registerScript(func, pattern = '.*') {
|
||||
export function registerScript(func, pattern = '.*') {
|
||||
__scripts.push({ "function": func, "pattern": pattern });
|
||||
}
|
||||
|
||||
function runScripts(node) {
|
||||
export function runScripts(node) {
|
||||
__scripts.forEach(script => {
|
||||
if (window.location.pathname.match(script.pattern)) {
|
||||
script.function(node);
|
||||
|
@ -31,7 +31,7 @@ function findPreloader() {
|
|||
return document.getElementById('preloader');
|
||||
}
|
||||
|
||||
function runAfterLoad(func, pattern = '.*') {
|
||||
export function runAfterLoad(func, pattern = '.*') {
|
||||
let preloader = findPreloader();
|
||||
if (typeof preloader !== undefined && preloader.style.display !== "none") {
|
||||
__afterLoadScripts.push({ "function": func, "pattern": pattern });
|
||||
|
|
|
@ -1 +1 @@
|
|||
const aniBlue = '#348fff';
|
||||
export const aniBlue = '#348fff';
|
|
@ -1,7 +1,7 @@
|
|||
var isShiftPressed = false;
|
||||
var isCtrlPressed = false;
|
||||
export var isShiftPressed = false;
|
||||
export var isCtrlPressed = false;
|
||||
|
||||
function isHtmlElement(object) {
|
||||
export function isHtmlElement(object) {
|
||||
return object instanceof HTMLElement;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue