Skip to content

Commit

Permalink
Option to remove blue mark for blue subscribers
Browse files Browse the repository at this point in the history
  • Loading branch information
khalen56 committed Nov 11, 2022
1 parent c388029 commit 1e8e7d9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
4 changes: 4 additions & 0 deletions chrome/options.chrome.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
<label for="textEnableBorder">Enable Border</label>
<input type="checkbox" id="textEnableBorder" />
</div>
<div class="option text-option checkboxes">
<label for="removeBlueMark">Remove Blue Mark</label>
<input type="checkbox" id="removeBlueMark" />
</div>
<button id="save">Save</button>
</div>
</div>
Expand Down
6 changes: 5 additions & 1 deletion chrome/options.chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function onTextEnabledChange() {
function saveOptions() {
const memeMode = document.getElementById("memeMode").checked;
const textEnabled = document.getElementById("textEnabled").checked;
const removeBlueMark = document.getElementById("removeBlueMark").checked;
const textVerifiedLabel = document.getElementById("textVerifiedLabel").value;
const twitterBlueVerifiedLabel = document.getElementById(
"textTwitterBlueLabel"
Expand All @@ -22,8 +23,9 @@ function saveOptions() {
textOptions: {
textVerifiedLabel: textEnabled ? textVerifiedLabel : "",
twitterBlueVerifiedLabel: textEnabled ? twitterBlueVerifiedLabel : "",
enableBorder: textEnabled ? textEnableBorder : true
enableBorder: textEnabled ? textEnableBorder : true,
},
removeBlueMark: removeBlueMark ? removeBlueMark : false
},
function () {
const status = document.getElementById("status");
Expand All @@ -45,10 +47,12 @@ function restoreOptions() {
twitterBlueLabel: "Paid",
enableBorder: true,
},
removeBlueMark: false
},
function (items) {
document.getElementById("memeMode").checked = items.memeMode;
document.getElementById("textEnabled").checked = items.textEnabled;
document.getElementById("removeBlueMark").checked = items.removeBlueMark;
document.getElementById("textVerifiedLabel").value =
items.textOptions.verifiedLabel;
document.getElementById("textTwitterBlueLabel").value =
Expand Down
1 change: 1 addition & 0 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const defaultConfig = {
twitterBlueLabel: "Paid",
enableBorder: true
},
removeBlueMark: false
};

function createSettingsDomNode(items) {
Expand Down
13 changes: 9 additions & 4 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const TEXT_ENABLED = data.textEnabled;
const TEXT_VERIFIED_LABEL = data.textOptions?.verifiedLabel || "";
const TEXT_TWITTER_BLUE_LABEL = data.textOptions?.twitterBlueLabel || "";
const TEXT_ENABLE_BORDER = data.textOptions?.enableBorder || true;

const REMOVE_BLUE = data.removeBlueMark || false;

const BLUE_CHECK_PATTERN =
'svg path[d^="M22.25 12c0-1.43-.88-2.67-2.19-3.34.46-1.39.2-2.9-.81-3.91s-2.52-1.27-3.91-.81c-.66-1.31-1.91-2.19-3.34-2.19s-2.67.88-3.33 2.19c-1.4-.46-2.91-.2-3.92.81s-1.26 2.52-.8 3.91c-1.31.67-2.2 1.91-2.2 3.34s.89 2.67 2.2 3.34c-.46 1.39-.21 2.9.8 3.91s2.52 1.26 3.91.81c.67 1.31 1.91 2.19 3.34 2.19s2.68-.88 3.34-2.19c1.39.45 2.9.2 3.91-.81s1.27-2.52.81-3.91c1.31-.67 2.19-1.91 2.19-3.34zm-11.71 4.2L6.8 12.46l1.41-1.42 2.26 2.26 4.8-5.23 1.47 1.36-6.2 6.77z"]';
Expand Down Expand Up @@ -45,6 +45,7 @@ function changeVerified(elm, isSmall) {
}

function changeBlueVerified(elm, isSmall) {

const svg = MEME_MODE ? `${COMIC_SANS_BLUE_DOLLAR_SVG}` : `${REGULAR_BLUE_DOLLAR_SVG}`;
const small = `${svg}`;
const big = `
Expand All @@ -53,10 +54,14 @@ function changeBlueVerified(elm, isSmall) {
<p style=' font-size: 0.8rem; margin: 0; font-weight: 600;'>${TEXT_TWITTER_BLUE_LABEL}</p>
</div>`
try {
if (isSmall || !TEXT_ENABLED) {
elm.parentElement.innerHTML = small;
if (REMOVE_BLUE) {
elm.closest('svg').remove();
} else {
elm.parentElement.parentElement.parentElement.innerHTML = big;
if (isSmall || !TEXT_ENABLED) {
elm.parentElement.innerHTML = small;
} else {
elm.parentElement.parentElement.parentElement.innerHTML = big;
}
}
} catch (e) {
console.log(elm);
Expand Down

0 comments on commit 1e8e7d9

Please sign in to comment.