Removed fonts, using webfonts instead. Kinda-finished css, uw.js now also loads CSS.

This commit is contained in:
Tamius Han 2016-12-04 23:02:15 +01:00
parent ca33454677
commit 27742d31a6
7 changed files with 60 additions and 137 deletions

View File

@ -1,3 +1,11 @@
var debugmsg = true;
if(debugmsg){
console.log(". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ");
console.log("\nLoading ultrawidify (uw)\nIf you can see this, extension at least tried to load\n\nRandom number: ",Math.floor(Math.random() * 20) + 1,"\n");
console.log(". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ");
}
var extraClassAdded = false;
var inFullScreen = false;
@ -6,8 +14,8 @@ var zoomStep = 0.05;
var whatdo_persistence = true;
var last_whatdo = "reset";
var page_url = window.location.toString();
var debugmsg = true;
var ctlbar_classnames = ["ytp-chrome-controls"];
var serviceArray = [".video-stream" ]; //Youtube
@ -15,6 +23,46 @@ var serviceArray = [".video-stream" ]; //Youtube
var buttons = [];
//BEGIN ADDING CSS
// Če ponovno naložimo dodatek, potem odstranimo star CSS. Lahko se zgodi, da je Tam spremenil CSS in hoče
// preveriti, če stvari zgledajo tako kot morajo. Če ima en razred/id več nasprotujoćih si definicij, potem
// nam to lahko povzroča težave. Za uporabnike je načeloma odstranjevanje obstoječega CSS brezpredmetno, ker
// uporabnik ponavadi ne bo reloadal razširitve.
//
// If we reload the extension, then we also remove our old CSS. It can easily happen that Tam changed CSS a bit
// and wants to see if things look roughly the way they should. We do this because if a class/id has multiple
// mutually exclusive definitions, we can get some problems with CSS not working the way it should. People who
// aren't Tam generally don't see the benefit as they won't reload the extension — let alone reload the extension
// after messing with CSS.
var uwcss = document.getElementsByClassName("uw_css");
while(uwcss && uwcss.length > 0)
uwcss[0].parentNode.removeChild(uwcss[0]);
// funkcija pomagač za ustvarjanje css linkov
// helper function for creating css links
function addLink(css_url){
var link = document.createElement("link");
link.className = "uw_css";
link.setAttribute("rel","stylesheet");
link.setAttribute("type","text/css");
link.setAttribute("href", resourceToUrl(css_url));
$("head").append(link);
}
// Vsaka stran dobi uw_common.css
// We add uw_common.css on every page
addLink("res/css/uw_common.css");
// Če smo na Youtube/youtube popupu, dodamo css za youtube elemente
// If we're on youtube/youtube popup, we add css for youtube elements
if(page_url.indexOf("youtu") != -1){
addLink("res/css/uw_yt.css");
}
//END ADDING CSS
// Yeah hi /r/badcode.
// Anyway, because nazi localstorage flat out refuses to store arrays:
var DEFAULT_KEYBINDINGS = {
@ -81,19 +129,15 @@ ask4keybinds.then( (res) => {
else{
KEYBINDS = res[0].ultrawidify_keybinds;
}
console.log("res. ", res[0].ultrawidify_keybinds);
// console.log("res. ", res[0].ultrawidify_keybinds);
});
$(document).ready(function() {
if(debugmsg)
console.log("==========================================================================================");
console.log("=============================================================================================");
$(document).keydown(function (event) { // Tukaj ugotovimo, katero tipko smo pritisnili
@ -217,7 +261,7 @@ function addCtlButtons(provider_id){
for( var i = 5; i >= 0; i--){
buttons[i] = document.createElement('div');
buttons[i].style.backgroundImage = 'url(' + imageToUrl("/img/ytplayer-icons/" + button_def[i] + ".png") + ')';
buttons[i].style.backgroundImage = 'url(' + resourceToUrl("/res/img/ytplayer-icons/" + button_def[i] + ".png") + ')';
buttons[i].style.width = (button_width * 0.75) + "px";
// buttons[i].style.marginLeft = (button_width * 0.3) + "px";
buttons[i].style.paddingLeft = (button_width *0.15 ) + "px";
@ -286,8 +330,6 @@ function addCtlButtons(provider_id){
smenu_el[0].id = "uw-smenu_settings";
smenu_el[6].id = "uw-smenu_ar";
smenu_ar_menu.id = "uw-armenu";
@ -341,26 +383,7 @@ function addCtlButtons(provider_id){
for(var i = 0; i < smenu_ar_options.length; i++){
smenu_ar_options[0].height = smenu_item_height + "px";
}
// smenu_el[5].style.width = (button_width * 7.5) + "px";
// smenu_el[5].style.fontSize = (button_width * 0.50) + "px";
// // smenu_el[5].style = (button_width * ) + "px";
//
// smenu_el[4].style.width = (button_width * 7.5) + "px";
// smenu_el[4].style.fontSize = (button_width * 0.5) + "px";
// // smenu_el[4].style = (button_width * ) + "px";
//
// smenu_el[3].style.width = (button_width * 7.5) + "px";
// smenu_el[3].style.fontSize = (button_width * 0.5) + "px";
// // smenu_el[3].style = (button_width * ) + "px";
//
// smenu_el[1].style.width = (button_width * 7.5) + "px";
// smenu_el[1].style.fontSize = (button_width * 0.5) + "px";
// // smenu_el[1].style = (button_width * ) + "px";
//
// smenu_el[2].style.width = (button_width * 7.5) + "px";
// smenu_el[2].style.fontSize = (button_width * 0.5) + "px";
// // smenu_el[2].style = (button_width * ) + "px";
// Tukaj se določa notranji HTML knofov
// Inner HTML of elements is defined here
@ -400,7 +423,6 @@ function addCtlButtons(provider_id){
smenu_ar_options[2].onclick = function(event) {event.stopPropagation(); changeCSS("char", (16/9 )); };
smenu_ar_options[3].onclick = function(event) {event.stopPropagation(); changeCSS("char", (21/9 )); };
// console.log(smenu_el[0]);
// smenu_el[0].onclick = function() { showSettings() };
smenu_el[5].onclick = function (event) {event.stopPropagation(); changeCSS("fit" ,"fitw" ) };
@ -467,7 +489,7 @@ function addCtlButtons(provider_id){
</div>"
e_player.appendChild(menu_panel);
menu_panel.appendChild(settings_content);
// menu_panel.appendChild(settings_content);
@ -665,8 +687,8 @@ function set_video_ar(aspect_ratio, video, player){
return;
}
//Širina, višina, top, left za nov video
//Width, height, top and left for the new video
// Širina, višina, top, left za nov video
// Width, height, top and left for the new video
var nv = { "w":0, "h":0, "top":0, "left":0 };
/*
@ -888,7 +910,7 @@ function inIframe(){
}
}
function imageToUrl(img){
function resourceToUrl(img){
return chrome.extension.getURL(img);
}

View File

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Ultrawidify-git",
"version": "0.9.9.5",
"version": "0.9.9.6",
"icons": {
"32":"res/icons/uw-32.png",
@ -32,13 +32,9 @@
"res/img/ytplayer-icons/reset.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",
"res/css/uw_settings.css"
]
}

View File

@ -1,7 +1,4 @@
@font-face{
font-family: 'Oxygen-regular';
src:
}
@import url('https://fonts.googleapis.com/css?family=Oxygen:300,400&subset=latin-ext');
.show{
display: block !important;

View File

@ -1,92 +0,0 @@
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.

Binary file not shown.

Binary file not shown.

Binary file not shown.