Commit 2b5adbc0 authored by Ronane's avatar Ronane
Browse files

Premier commit du code

parent 8e2f9695
{
"description": "Do you miss WIZZ ?",
"manifest_version": 2,
"name": "Wizztodon",
"version": "1.3",
"homepage_url": "https://mamot.fr/@ronane",
"permissions": [
"<all_urls>"
],
"icons": {
"96": "./Wizz_logo_96.png"
},
"content_scripts": [{
"matches": ["<all_urls>"],
"js": ["./wizz.js"],
"css": ["./wizz.css"]
}
],
"web_accessible_resources": [
"nudge.mp3"
]
}
File added
@keyframes wizz {
0% {transform: rotate(0);}
5% {background-color: rgb(250, 255, 140) !important;}
10% {transform: rotate(-11deg);}
20% {transform: rotate(11deg);}
30% {transform: rotate(-8deg);}
40% {transform: rotate(8deg);}
50% {transform: rotate(-5deg);}
60% {transform: rotate(5deg);}
70% {transform: rotate(-3deg);}
80% {transform: rotate(3deg);}
90% {transform: rotate(-1deg);}
100% {transform: rotate(1deg);}
}
.wizz {
animation: wizz 0.5s ease 9 alternate;
}
\ No newline at end of file
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
var expr = /tags\/wizz/i;
var config = {
attributes: true,
childList: true,
subtree: true
};
var callback = function (mutations, observer) {
mutations.forEach(function (mutation) {
if (mutation.type === 'childList') {
var firstChild = mutation.target.firstChild;
if (firstChild.innerHTML.match(expr)) {
console.log("wiZZ");
firstChild.className = "wizz";
var nudge = browser.extension.getURL("nudge.mp3");
console.log(nudge);
new Audio(nudge).play();
}
}
});
};
var observer = new MutationObserver(callback);
sleep(3000).then(() => {
var columns = document.querySelectorAll("div.column div.item-list");
columns.forEach(function (element) {
observer.observe(element, config);
});
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment