Skip to content

Commit d7fb082

Browse files
committed
Add exclusive hiding functionality
1 parent a0ffc65 commit d7fb082

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class RevShare extends HTMLElement {
44
this.style.margin = "0";
55
this.style.padding = "0";
66
if (this.hasAttribute('exclusive')){
7-
this.style.display = "none";
7+
this.classList.add('rs-excl-hid');
88
}
99
}
1010
attributeChangedCallback() {
@@ -71,12 +71,16 @@ function genMeta() {
7171
document.head.appendChild(monTag);
7272
}
7373

74+
var element = document.createElement("style");
75+
element.innerHTML = ".rs-excl-hid {display: none;}";
76+
document.head.appendChild(element);
77+
7478
window.addEventListener('load', () => {
7579
genMeta();
7680
});
7781

7882
if (document.monetization) {
7983
document.monetization.addEventListener('monetizationstart', () => {
80-
document.querySelectorAll('rev-share[exclusive]').forEach(i => delete i.style.display);
84+
Array.from(document.querySelectorAll('rev-share[exclusive]')).forEach(i => i.classList.remove('rs-excl-hid'));
8185
});
8286
}

index.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kewbish/revshare",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "A JS library for revenue-sharing, made for #gftwhackathon.",
55
"main": "index.min.js",
66
"keywords": [

0 commit comments

Comments
 (0)