Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new banner #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added ext/images/alttcslogo_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ext/images/shitori_banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ext/images/suspicious_satori_banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ext/images/suspicious_shitori_banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
109 changes: 109 additions & 0 deletions ext/images/tcslogo_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ext/images_src/alttcs_white.xcf
Binary file not shown.
Binary file added ext/images_src/shitori_banner.xcf
Binary file not shown.
Binary file added ext/images_src/suspicious_satori_banner.xcf
Binary file not shown.
Binary file added ext/images_src/suspicious_shitori_banner.xcf
Binary file not shown.
26 changes: 21 additions & 5 deletions ext/js/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
browser.runtime.sendMessage({action: 'enablePageAction'});

const BANNER_URL = browser.extension.getURL('images/satori_banner.png');
const SHITORI_BANNER_URL = browser.extension.getURL('images/shitori_banner.png');
const SUSPICIOUS_SATORI_BANNER_URL = browser.extension.getURL('images/suspicious_satori_banner.png');
const SUSPICIOUS_SHITORI_BANNER_URL = browser.extension.getURL('images/suspicious_shitori_banner.png');
const TCS_LOGO_URL = browser.extension.getURL('images/tcslogo.svg');
const TCS_LOGO_WHITE_URL = browser.extension.getURL('images/tcslogo_white.svg');
const ALT_TCS_LOGO_URL = browser.extension.getURL('images/alttcslogo.png');
const ALT_TCS_WHITE_LOGO_URL = browser.extension.getURL('images/alttcslogo_white.png');

let storage = browser.storage.sync || browser.storage.local;

Expand All @@ -14,10 +19,15 @@
storage.get({
[CHOSEN_LOGO_PRIMARY_KEY]: DEFAULT_SETTINGS[CHOSEN_LOGO_PRIMARY_KEY]
}).then(response => {
let newLogoUrl = {
const newLogoUrl = {
satoriPremium: BANNER_URL,
shitoriPremium: SHITORI_BANNER_URL,
suspiciousSatoriPremium: SUSPICIOUS_SATORI_BANNER_URL,
suspiciousShitoriPremium: SUSPICIOUS_SHITORI_BANNER_URL,
tcs: TCS_LOGO_URL,
tcsWhite: TCS_LOGO_WHITE_URL,
alternative: ALT_TCS_LOGO_URL,
alternativeWhite: ALT_TCS_WHITE_LOGO_URL,
}[response[CHOSEN_LOGO_PRIMARY_KEY]];
$('img[src="/files/satori_banner.png"]').attr('src', newLogoUrl);
});
Expand All @@ -40,10 +50,16 @@
if (chosenLogo === 'none') {
return;
}
let url = chosenLogo === 'alternative' ?
ALT_TCS_LOGO_URL : TCS_LOGO_URL;
let logo = $('<img/>').attr('src', url);
let div = $('<div id="satoriEnhancementsTCSLogo"/>').append(logo);

const newLogoUrl = {
tcs: TCS_LOGO_URL,
tcsWhite: TCS_LOGO_WHITE_URL,
alternative: ALT_TCS_LOGO_URL,
alternativeWhite: ALT_TCS_WHITE_LOGO_URL,
}[chosenLogo];

const logo = $('<img/>').attr('src', newLogoUrl);
const div = $('<div id="satoriEnhancementsTCSLogo"/>').append(logo);
$('#navigationPanel').after(div);
});
}
Expand Down
61 changes: 61 additions & 0 deletions ext/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,33 @@ <h2>Primary logo</h2>
value="satoriPremium">
</label>
</div>
<div class="image-chooser-tile">
<label>
<div class="image-chooser-content">
<img src="images/shitori_banner.png"/>
</div>
<input type="radio" name="primary-logo-chooser"
value="shitoriPremium">
</label>
</div>
<div class="image-chooser-tile">
<label>
<div class="image-chooser-content bg-dark">
<img src="images/suspicious_satori_banner.png"/>
</div>
<input type="radio" name="primary-logo-chooser"
value="suspiciousSatoriPremium">
</label>
</div>
<div class="image-chooser-tile">
<label>
<div class="image-chooser-content bg-dark">
<img src="images/suspicious_shitori_banner.png"/>
</div>
<input type="radio" name="primary-logo-chooser"
value="suspiciousShitoriPremium">
</label>
</div>
<div class="image-chooser-tile">
<label>
<div class="image-chooser-content">
Expand All @@ -34,6 +61,23 @@ <h2>Primary logo</h2>
<input type="radio" name="primary-logo-chooser" value="alternative">
</label>
</div>
<div class="image-chooser-tile">
<label>
<div class="image-chooser-content bg-dark">
<img src="images/tcslogo_white.svg"/>
</div>
<input type="radio" name="primary-logo-chooser" value="tcsWhite">
</label>
</div>
<div class="image-chooser-tile">
<label>
<div class="image-chooser-content bg-dark">
<img src="images/alttcslogo_white.png"/>
</div>
<input type="radio" name="primary-logo-chooser"
value="alternativeWhite">
</label>
</div>
</form>

<h2>Secondary logo</h2>
Expand Down Expand Up @@ -61,6 +105,23 @@ <h2>Secondary logo</h2>
value="alternative">
</label>
</div>
<div class="image-chooser-tile">
<label>
<div class="image-chooser-content bg-dark">
<img src="images/tcslogo_white.svg"/>
</div>
<input type="radio" name="secondary-logo-chooser" value="tcsWhite">
</label>
</div>
<div class="image-chooser-tile">
<label>
<div class="image-chooser-content bg-dark">
<img src="images/alttcslogo_white.png"/>
</div>
<input type="radio" name="secondary-logo-chooser"
value="alternativeWhite">
</label>
</div>
</form>

<h2>Syntax highlighter style</h2>
Expand Down
6 changes: 5 additions & 1 deletion ext/scss/options.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ h2:not(:first-child) {
& > .image-chooser-tile {
display: inline-block;
text-align: center;
margin-right: 20px;
margin: 0 20px 20px 0;

.image-chooser-content {
width: 96px;
Expand All @@ -17,6 +17,10 @@ h2:not(:first-child) {
align-items: center;
}

.image-chooser-content.bg-dark {
background-color: #000;
}

.image-chooser-content img {
max-width: 96px;
height: auto;
Expand Down