Taking CSS out of the uw.js and placing it into its own file, laid out the foundations for this change in manifest.json. NOTE: this commit just laid the groundwork,

uw_common.css is unfinished (font-face block isn't even properly closed) and uw.js wasn't updated to include CSS files yet.
This commit is contained in:
Tamius Han 2016-12-04 12:01:38 +01:00
parent 7856f993a4
commit ca33454677
18 changed files with 214 additions and 109 deletions

107
js/uw.js
View File

@ -15,106 +15,6 @@ var serviceArray = [".video-stream" ]; //Youtube
var buttons = []; var buttons = [];
console.log("????");
$("<style>")
.prop("type", "text/css")
.html("\
.uw-button{\
display: inline-block;\
height: 100% !important; \
background-size: 75% 75%; \
background-repeat: no-repeat;\
background-position: center center;\
}\
.uw-button:hover{\
background-color: rgba(192,0,0,0.66);\
}\
.uw-setmenu{\
display: none;\
position: absolute;\
background-color: rgba(0,0,0,0.66);\
right: 0px;\
}\
.uw-setmenu-item{\
display: flex;\
align-items: center;\
font-family: \"Oxygen\";\
color: #ffffff !important;\
width: 90%;\
padding-left: 10%;\
}\
.uw-setmenu-item:hover{\
background-color: rgba(192,0,0,0.66);\
}\
.show{\
display: block;\
}\
.uw_hide{\
display: none !important;\
}\
.uw-ext-settings-bg{\
display: none;\
position: absolute !important;\
width: 100% !important;\
height: 100% !important;\
z-index: 1000 !important;\
\
background-color: rgba(0,0,0,0.69) !important;\
color: #fff !important; \
font-family: 'Oxygen' !important;\
text-align: center;\
\
}\
.uw-ext-settings-content{\
display: inline-block;\
min-width: 75%;\
max-width: 90%;\
text-align: left;\
padding: 2em !important;\
font-size: 1.4em;\
font-family: 'Oxygen' !important;\
}\
.uw_top{\
z-index: 1337;\
}\
.uw-h1{\
font-size: 4em !important;\
color: #f46007 !important;\
font-family: 'Oxygen' !important;\
}\
.uw_settings_tab{\
font-size: 1.4em !important;\
padding-left: 1em;\
color: #ddd !important;\
}\
.uw_settings_tab:hover{\
font-size: 1.6em;\
padding-left: 1.6em;\
color: #ffdb6e !important;\
}\
.uw_settings_tabbar{\
display: inline-block;\
float: left;\
width: 15em;\
}\
.uw_settings_container{\
display: inline-block;\
float: right;\
width: calc(99% - 15em);\
}\
.uw_settings_kbshortcuts_label{\
display: inline-block;\
width: 15em;\
}\
.uw_settings_kbshortcuts_input{\
width: 1.5em;\
}\
")
.appendTo("head");
// Yeah hi /r/badcode. // Yeah hi /r/badcode.
// Anyway, because nazi localstorage flat out refuses to store arrays: // Anyway, because nazi localstorage flat out refuses to store arrays:
var DEFAULT_KEYBINDINGS = { var DEFAULT_KEYBINDINGS = {
@ -262,9 +162,11 @@ function saveKeybinds(){
function addCtlButtons(provider_id){ function addCtlButtons(provider_id){
var buttonClass = "ytp-button ytp-settings-button";
// Gumb za nastavitve je bolj kot ne vselej prisoten, zato širino tega gumba uporabimo kot širino naših gumbov // Gumb za nastavitve je bolj kot ne vselej prisoten, zato širino tega gumba uporabimo kot širino naših gumbov
// Settings button is more or less always there, so we use its width as width of our buttons // Settings button is more or less always there, so we use its width as width of our buttons
var button_width = document.getElementsByClassName("ytp-button ytp-settings-button")[0].scrollWidth; var button_width = document.getElementsByClassName(buttonClass)[0].scrollWidth;
var button_def = [ "fitw", "fith", "reset", "zoom", "uzoom", "settings" ]; var button_def = [ "fitw", "fith", "reset", "zoom", "uzoom", "settings" ];
@ -607,6 +509,9 @@ function onFullScreenChange(){
document.getElementById("uw-smenu").style.bottom = (button_width * 1.5) + "px"; document.getElementById("uw-smenu").style.bottom = (button_width * 1.5) + "px";
//Sedaj poglejmo še, če lahko v nadzorno vrstico spravimo vse gumbe
//Let's see if we can get all the buttons in the control bar
var rctl = document.getElementsByClassName("ytp-right-controls")[0];
} }

View File

@ -5,8 +5,8 @@
"version": "0.9.9.5", "version": "0.9.9.5",
"icons": { "icons": {
"32":"icons/uw-32.png", "32":"res/icons/uw-32.png",
"64":"icons/uw-64.png" "64":"res/icons/uw-64.png"
}, },
"description": "Aspect ratio fixer for youtube that works around some people's disability to properly encode 21:9 (and sometimes, 16:9) videos.", "description": "Aspect ratio fixer for youtube that works around some people's disability to properly encode 21:9 (and sometimes, 16:9) videos.",
@ -25,11 +25,20 @@
], ],
"web_accessible_resources": [ "web_accessible_resources": [
"img/ytplayer-icons/zoom.png", "res/img/ytplayer-icons/zoom.png",
"img/ytplayer-icons/uzoom.png", "res/img/ytplayer-icons/uzoom.png",
"img/ytplayer-icons/fitw.png", "res/img/ytplayer-icons/fitw.png",
"img/ytplayer-icons/fith.png", "res/img/ytplayer-icons/fith.png",
"img/ytplayer-icons/reset.png", "res/img/ytplayer-icons/reset.png",
"img/ytplayer-icons/settings.png" "res/img/ytplayer-icons/settings.png",
"res/fonts/Oxygen-Bold.tff",
"res/fonts/Oxygen-Light.tff",
"res/fonts/Oxygen-Regular.tff",
"res/css/uw_common.css",
"res/css/uw_yt.css",
"res/css/uw_netflix.css",
"res/css/uw_settings.css",
] ]
} }

11
res/css/uw_common.css Normal file
View File

@ -0,0 +1,11 @@
@font-face{
font-family: 'Oxygen-regular';
src:
}
.show{
display: block !important;
}
.uw_hide{
display: none !important;
}

4
res/css/uw_netflix.css Normal file
View File

@ -0,0 +1,4 @@
/* this is a placeholder file until I get around to actually
* implementing netflix support. This will probably happen by
* the end of 2016 (depends on how and when I get to getting
* my free month of netflix */

1
res/css/uw_settings.css Normal file
View File

@ -0,0 +1 @@
/* yeah this is also a placeholder file, this time for 'settings' page */

83
res/css/uw_yt.css Normal file
View File

@ -0,0 +1,83 @@
.uw-button{
display: inline-block;
height: 100% !important;
background-size: 75% 75%;
background-repeat: no-repeat;
background-position: center center;
}
.uw-button:hover{
background-color: rgba(192,0,0,0.66);
}
.uw-setmenu{
display: none;
position: absolute;
background-color: rgba(0,0,0,0.66);
right: 0px;
}
.uw-setmenu-item{
display: flex;
align-items: center;
font-family: "Oxygen";
color: #ffffff !important;
width: 90%;
padding-left: 10%;
}
.uw-setmenu-item:hover{
background-color: rgba(192,0,0,0.66);
}
/*.uw-ext-settings-bg{
display: none;
position: absolute !important;
width: 100% !important;
height: 100% !important;
z-index: 1000 !important;
background-color: rgba(0,0,0,0.69) !important;
color: #fff !important;
font-family: 'Oxygen' !important;
text-align: center;
}*//*
.uw-ext-settings-content{
display: inline-block;
min-width: 75%;
max-width: 90%;
text-align: left;
padding: 2em !important;
font-size: 1.4em;
font-family: 'Oxygen' !important;
}*/
.uw_top{
z-index: 1337;
}
/*.uw-h1{
font-size: 4em !important;
color: #f46007 !important;
font-family: 'Oxygen' !important;
}*//*
.uw_settings_tab{
font-size: 1.4em !important;
padding-left: 1em;
color: #ddd !important;
}*/
/*.uw_settings_tab:hover{
font-size: 1.6em;
padding-left: 1.6em;
color: #ffdb6e !important;
}*/
/*.uw_settings_tabbar{
display: inline-block;
float: left;
width: 15em;
}*/
/*.uw_settings_container{
display: inline-block;
float: right;
width: calc(99% - 15em);
}*/
/*.uw_settings_kbshortcuts_label{
display: inline-block;
width: 15em;
}*/
/*.uw_settings_kbshortcuts_input{
width: 1.5em;
}*/

92
res/fonts/OFL.txt Normal file
View File

@ -0,0 +1,92 @@
Copyright (c) 2012, vernon adams (vern@newtypography.co.uk), with Reserved Font Names 'Oxygen'
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

BIN
res/fonts/Oxygen-Bold.ttf Normal file

Binary file not shown.

BIN
res/fonts/Oxygen-Light.ttf Normal file

Binary file not shown.

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 317 B

After

Width:  |  Height:  |  Size: 317 B

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB