Subpage under development, new version coming soon!
Asunto: SkUnk - dodatek do sokkera
kryminator para
K@zuya Mishima
Nowa wersja.
VERSION 2020.3
FIXES
> Calculating junior matches should work now
> [Opera] Options should work now normally
> Minor fix for showing statistics where not all matches in the round
were finished
> Minor statistics improvement letting them work on earlier versions
of browsers (min. FF version was apparently 63 and now it should be lower
although never checked)
> [Old layout] Minor bugfix for showing attendance statistics on old layout
> Fixed functionalities which works on forum topic pages (topic page is
recognized better and excludes being new topic page or edit post page)
CHANGES
> SkUnk options should always open in new tab on every browser
(although 2020.x+ version of SkUnk in older versions of browsers may not)
> More changes in SkUnk options - I used sweetalert.js library to enhance
look of alert/confirm dialogs and especially to not use normal alert/confirm
because they were causing problems in Chrome and its derivatives
> Changed player estimation page to be sokker-manager.net instead
of sokker.worldofbarter.com and it should work now
Główny feature tej wersji to "integracja" ze stronką sokker.manager.net celem wyestymowania ceny za zawodnika (ikonka $ na stronie zawodnika, kiedyś to działało z inną stronką, ale odkąd tamta przestała działać to i to przestało, ale teraz powinno działać tyle że z inną stronką). Poza tym, jakieś poprawki w statystykach ligowych oraz opcjach SkUnka
a jeszcze jakby kogoś to interesowało to takie zmiany/funkcje MOGĄ zostać dodane w przyszłości:
> jak tworze, a właściwie to wydaję wersję dodatku dla Firefoxa to przechodzi on jakąś mozillową walidację i ona w tej chwili ponad 100 ostrzeżeń mi wypluwa (między 100 a 200, nie pamiętam dokładnie), mam zamiar jak nawjięcej ich popoprawiać
> z shortlistą skunkową są związane takie rzeczy jak kategorie i mam zamiar to trochę rozszerzyć, że to będą raczej coś jakby tagi a nie kategorie i zawodnik będzie mógł mieć więcej niż 1 tag i będą się wyświetlać przy zawodniku, na stronie ze skłądem, mozę też na stronie transferów i w biurze jak teraz te kategorie i moze gdzies jeszcze
> obliczanie meczow barazowych
> szablony wiadomości użytkownika (przy zawodniku jest ikonka z pocztą ze skunka i tam domyslnie jest konkretna wiadomość i mozna ją zmianić recznie a ja zamierzam dodac mozliwosc definiowania szablonow przez uzytkonika w opcjach, ustawiania domyslnego i tam beda do wyboru one, oprcz tego co jest)
> statystyki ligowe z wszystkich sezonów (coś jak to co dzidzia dla esktry wrzuca)
> może pojawi się guziczek SkUnka na pasku narzędzi (nie jestem pewien czy to tak się zwie, ale obok pola na adres stronki i wyszukanie w google) z funkcjami: Otwórz opcje SkUnka, Przygotuj bajeranckie losowanie fazy grupowej (jak to co Arek/wiesio wam serwują), coś jeszcze?
> wersja na Edge?
> szacowanie talentu juniora metodą regresji liniowej dla plusowaiczów (jak w oSokker)
VERSION 2020.3
FIXES
> Calculating junior matches should work now
> [Opera] Options should work now normally
> Minor fix for showing statistics where not all matches in the round
were finished
> Minor statistics improvement letting them work on earlier versions
of browsers (min. FF version was apparently 63 and now it should be lower
although never checked)
> [Old layout] Minor bugfix for showing attendance statistics on old layout
> Fixed functionalities which works on forum topic pages (topic page is
recognized better and excludes being new topic page or edit post page)
CHANGES
> SkUnk options should always open in new tab on every browser
(although 2020.x+ version of SkUnk in older versions of browsers may not)
> More changes in SkUnk options - I used sweetalert.js library to enhance
look of alert/confirm dialogs and especially to not use normal alert/confirm
because they were causing problems in Chrome and its derivatives
> Changed player estimation page to be sokker-manager.net instead
of sokker.worldofbarter.com and it should work now
Główny feature tej wersji to "integracja" ze stronką sokker.manager.net celem wyestymowania ceny za zawodnika (ikonka $ na stronie zawodnika, kiedyś to działało z inną stronką, ale odkąd tamta przestała działać to i to przestało, ale teraz powinno działać tyle że z inną stronką). Poza tym, jakieś poprawki w statystykach ligowych oraz opcjach SkUnka
a jeszcze jakby kogoś to interesowało to takie zmiany/funkcje MOGĄ zostać dodane w przyszłości:
> jak tworze, a właściwie to wydaję wersję dodatku dla Firefoxa to przechodzi on jakąś mozillową walidację i ona w tej chwili ponad 100 ostrzeżeń mi wypluwa (między 100 a 200, nie pamiętam dokładnie), mam zamiar jak nawjięcej ich popoprawiać
> z shortlistą skunkową są związane takie rzeczy jak kategorie i mam zamiar to trochę rozszerzyć, że to będą raczej coś jakby tagi a nie kategorie i zawodnik będzie mógł mieć więcej niż 1 tag i będą się wyświetlać przy zawodniku, na stronie ze skłądem, mozę też na stronie transferów i w biurze jak teraz te kategorie i moze gdzies jeszcze
> obliczanie meczow barazowych
> szablony wiadomości użytkownika (przy zawodniku jest ikonka z pocztą ze skunka i tam domyslnie jest konkretna wiadomość i mozna ją zmianić recznie a ja zamierzam dodac mozliwosc definiowania szablonow przez uzytkonika w opcjach, ustawiania domyslnego i tam beda do wyboru one, oprcz tego co jest)
> statystyki ligowe z wszystkich sezonów (coś jak to co dzidzia dla esktry wrzuca)
> może pojawi się guziczek SkUnka na pasku narzędzi (nie jestem pewien czy to tak się zwie, ale obok pola na adres stronki i wyszukanie w google) z funkcjami: Otwórz opcje SkUnka, Przygotuj bajeranckie losowanie fazy grupowej (jak to co Arek/wiesio wam serwują), coś jeszcze?
> wersja na Edge?
> szacowanie talentu juniora metodą regresji liniowej dla plusowaiczów (jak w oSokker)
Lipa91 para
kryminator
Nie mogę skopiować skilli grajka w innym języku niż polski - nie pojawiają się flagi..
Da się to jakoś poprawić?
Da się to jakoś poprawić?
kryminator para
Lipa91
teoretycznie powinno działać, u mnie na Vivaldim też działa, a jaka przegląradka i layout i czy PLUS czy nie?
(editado)
(editado)
kryminator para
Lipa91
color-black to obrazek tła, potrzebowałem wiedzieć czy nowy/stary, ale ok, rozumiem, że to nowy layout
być może to przez PLUSa, ale tego nei sprawdze, bo na razie wszytkie moje kombinacje działają, chociaż na Chrome-Chrome nie sprawdzałem, bo mój Vivaldi to powinien teoretycznie działać tak samo, ale może specjalnie go zainstaluję żeby obczaić
a kliknij we flagę wyboru języka, a potem to zamknij i spróbuj znowu z nożyczkami
aha i jeszcze pyytanie czy wcześniej działało ok?
być może to przez PLUSa, ale tego nei sprawdze, bo na razie wszytkie moje kombinacje działają, chociaż na Chrome-Chrome nie sprawdzałem, bo mój Vivaldi to powinien teoretycznie działać tak samo, ale może specjalnie go zainstaluję żeby obczaić
a kliknij we flagę wyboru języka, a potem to zamknij i spróbuj znowu z nożyczkami
aha i jeszcze pyytanie czy wcześniej działało ok?
Lipa91 para
kryminator
Tak to wygląda:
Normalnie w tooltipie było tak, że były flagi i mogłem w locie zmieniać język w jakim skopiuję skille.
jeszcze borykam się z drugim problemem - gdy wchodzę na grajka, który nie jest na TL/OT to zawsze wyskakuje taki popup:
Normalnie w tooltipie było tak, że były flagi i mogłem w locie zmieniać język w jakim skopiuję skille.
jeszcze borykam się z drugim problemem - gdy wchodzę na grajka, który nie jest na TL/OT to zawsze wyskakuje taki popup:
kryminator para
Lipa91
kurde, to muszą być problemy plusa, ja testuję zawsze na bezplusie :P
a ctrl+shift+j pokazuje jakieś błędy?
a ctrl+shift+j pokazuje jakieś błędy?
kryminator para
Lipa91
jeszcze odnośnie problemu pierwszego to obczaj jakiegoś zawodnika z TL, w sensie nie twojego zawodnika, takigo żeby nie miał skoków/spadków pozaznaczanych
Lipa91 para
kryminator
Na nim też nie mogę skpoiować w innym języku.
PS: ctrl+shift+j:
1) przy próbie kopiowania:
Mixed Content: The page at 'https://sokker.org/player/PID/36949814' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://sokker.org/get/part/lang_list'. This request has been blocked; the content must be served over HTTPS.
createFlagsDiv @ 501.lib_common.js:287
(anonymous) @ 514.lib_player.js:361
2) przy otwieraniu grajka
DevTools failed to load SourceMap: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/include.preload.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for chrome-extension://boolondjelffkkgnaplacfpobpfbgbfd/scripts/sprintf.min.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
37339438:647 GET https://connect.facebook.net/en_US/fbevents.js net::ERR_BLOCKED_BY_CLIENT
(anonymous) @ 37339438:647
(anonymous) @ 37339438:648
DevTools failed to load SourceMap: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/include.postload.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
00.jquery-2.2.0.min.js:4 Mixed Content: The page at 'https://sokker.org/player/PID/37339438' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://ntdb.sokker.cz/ntdb.php'. This request has been blocked; the content must be served over HTTPS.
send @ 00.jquery-2.2.0.min.js:4
ajax @ 00.jquery-2.2.0.min.js:4
getPlayersFromNTDB @ 521.lib_players.js:138
initShowNTPlayer @ 514.lib_player.js:651
doAllThatShit @ 66.sk_scripts.js:71
(anonymous) @ 87.generated_start.js:79
(anonymous) @ 20.extension.js:8
i @ 00.jquery-2.2.0.min.js:2
fireWith @ 00.jquery-2.2.0.min.js:2
z @ 00.jquery-2.2.0.min.js:4
(anonymous) @ 00.jquery-2.2.0.min.js:4
load (async)
send @ 00.jquery-2.2.0.min.js:4
ajax @ 00.jquery-2.2.0.min.js:4
n. @ 00.jquery-2.2.0.min.js:4
getJSON @ 00.jquery-2.2.0.min.js:4
executeWithLocale @ 20.extension.js:6
(anonymous) @ 87.generated_start.js:78
502.lib_general.js:218 Mixed Content: The page at 'https://sokker.org/player/PID/37339438' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://sokker.org/matchview?id=23152996'. This request has been blocked; the content must be served over HTTPS.
(anonymous) @ 502.lib_general.js:218
(anonymous) @ 20.extension.js:31
37339438:1 A cookie associated with a cross-site resource at https://facebook.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.
DevTools failed to load SourceMap: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/include.preload.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/include.postload.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/include.preload.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/include.postload.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
(editado)
PS: ctrl+shift+j:
1) przy próbie kopiowania:
Mixed Content: The page at 'https://sokker.org/player/PID/36949814' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://sokker.org/get/part/lang_list'. This request has been blocked; the content must be served over HTTPS.
createFlagsDiv @ 501.lib_common.js:287
(anonymous) @ 514.lib_player.js:361
2) przy otwieraniu grajka
DevTools failed to load SourceMap: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/include.preload.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for chrome-extension://boolondjelffkkgnaplacfpobpfbgbfd/scripts/sprintf.min.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
37339438:647 GET https://connect.facebook.net/en_US/fbevents.js net::ERR_BLOCKED_BY_CLIENT
(anonymous) @ 37339438:647
(anonymous) @ 37339438:648
DevTools failed to load SourceMap: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/include.postload.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
00.jquery-2.2.0.min.js:4 Mixed Content: The page at 'https://sokker.org/player/PID/37339438' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://ntdb.sokker.cz/ntdb.php'. This request has been blocked; the content must be served over HTTPS.
send @ 00.jquery-2.2.0.min.js:4
ajax @ 00.jquery-2.2.0.min.js:4
getPlayersFromNTDB @ 521.lib_players.js:138
initShowNTPlayer @ 514.lib_player.js:651
doAllThatShit @ 66.sk_scripts.js:71
(anonymous) @ 87.generated_start.js:79
(anonymous) @ 20.extension.js:8
i @ 00.jquery-2.2.0.min.js:2
fireWith @ 00.jquery-2.2.0.min.js:2
z @ 00.jquery-2.2.0.min.js:4
(anonymous) @ 00.jquery-2.2.0.min.js:4
load (async)
send @ 00.jquery-2.2.0.min.js:4
ajax @ 00.jquery-2.2.0.min.js:4
n. @ 00.jquery-2.2.0.min.js:4
getJSON @ 00.jquery-2.2.0.min.js:4
executeWithLocale @ 20.extension.js:6
(anonymous) @ 87.generated_start.js:78
502.lib_general.js:218 Mixed Content: The page at 'https://sokker.org/player/PID/37339438' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://sokker.org/matchview?id=23152996'. This request has been blocked; the content must be served over HTTPS.
(anonymous) @ 502.lib_general.js:218
(anonymous) @ 20.extension.js:31
37339438:1 A cookie associated with a cross-site resource at https://facebook.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.
DevTools failed to load SourceMap: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/include.preload.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/include.postload.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/include.preload.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/include.postload.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
(editado)
D@ni para
kryminator
a tagi w statystykach gracza, przy meczach, takie jak prosilem? :P bym sie mogl pozbyc wreszcie tego osokkera bo to chyba ostatnia funkcja ktora go trzyma u mnie :) Jak potrzebujesz plusa do tego to Ci kupie :)
Gdyby była opcja włączania/wyłączania plusa na własne życzenie, żeby mógł sobie kryminator testować na różnych opcjach, to pewnie by chętnie przyjął :P
kryminator para
Lipa91
pokaż plik 11.sk_scripts_initialize.js z folderu skunk/scripts, jest spory, więc pokaż mi tylko var _icons = {[cała zawartość bloku icons]}
i podobnie z pliku 501.lib_common.js pokaż linijke zawierającą "/get/part/lang_list"
i podobnie z pliku 501.lib_common.js pokaż linijke zawierającą "/get/part/lang_list"
kryminator para
D@ni
ja cały czas o tym pamiętam, tylko mam wrażenie, że nie potrafię tego zrobić tak żeby na 100% odróżniać środowy towarzyski, od chyba środowego arcade, znaczy nie pamietam dokładnie problemu, jaki się z tym wiązał, ale pamiętam że o takie coś prosiłeś
Gdyby była opcja włączania/wyłączania plusa na własne życzenie, żeby mógł sobie kryminator testować na różnych opcjach, to pewnie by chętnie przyjął :P
no, dla mnie to byłby ideał :P
Gdyby była opcja włączania/wyłączania plusa na własne życzenie, żeby mógł sobie kryminator testować na różnych opcjach, to pewnie by chętnie przyjął :P
no, dla mnie to byłby ideał :P
Lipa91 para
kryminator
11.sk_scripts_initialize.js
// Initialization of some global variables for extension injected scripts.
var locale = {};
var ntdb_players = {};
// Variable storing functional libraries.
var sk_libs = {};
// Icons
var _icons = {
assist : 'pic/assist.gif',
goal : 'http://files.sokker.org/pic/gool.gif',
playerCopy : 'http://www.sokker.cz/osokker/images/copy.png',
playerInjury : 'http://files.sokker.org/pic/kontuzja.gif',
playerInquiry : 'pic/ico_new_mail.gif',
redCard : 'http://files.sokker.org/pic/czerwona.gif',
shortlistAdd : 'pic/briefcase_ico.gif',
yellowCard : 'http://files.sokker.org/pic/zolta.gif'
};
// Predefined sorting kinds
var _sort = {
ASC : 'asc', // ascending sort
DESC : 'desc', // descending sort
NO : 'no' // no sorting
};
// Layout information
var _layout = {
// Current layout elements values.
background : null,
skin : null,
menu : null,
// Predefined layout elements values.
SKIN : {
OLD : 'old',
DEFAULT : 'default',
CYBORG : 'cyborg',
DARKLY : 'darkly',
LUMEN : 'lumen',
SLATE : 'slate',
SPACELAB : 'spacelab',
UNITED : 'united'
},
MENU : {
LEFT : 'left',
BOTTOM : 'bottom',
TOP : 'top'
},
// Stylesheets class declarations
classdef : {
btnIcon : '',
btnLink : '',
btnPrimary : '',
container1 : '',
container2 : '',
container3 : '',
favorite : '',
favoritesTable : '',
header : '',
linksContainerBtn : '',
popup : '',
popupDiv : '',
redBoldText : '',
table1 : '',
table2 : '',
title1 : '',
title2 : ''
},
// Style declarations
styledef : {
favoritesTable : '',
icon : '',
linksContainer : '',
linksContainerA : '',
linksContainerLi : '',
popupBorder : '',
shortlistTable : '',
teamSummaryTable : '',
xBtn : ''
},
// Colors declarations
color : {
tableBorder : ''
},
// HTML patterns declarations
html : {
button : '',
collapse : '',
expand : '',
favorite : '',
favoritesEmptyRow : '',
favoritesTable : '',
favMark : '',
hideMark : '',
hr : '',
infoMark : '',
lastPageLink : '',
linksContainerBtn : '',
noFavMark : '',
ntdbLink : '',
playerSkills : '',
playersSkills : '',
showMark : '',
showSkillsElem : '',
showSkillsInner : '',
skillNumber : '',
statsTable : '',
tacticBtnElem : '',
tacticBtnInner : '',
teamMatchesCntnr : '',
transferAlarm : ''
}
};
// Structure containing selectors for searching for various elements in webpage.
var _searcher = {
global : {
bbCodeToolbar : '',
clock : '',
generalContainer : '',
globalMenu : '',
menuContainer : '',
selectedLang : '',
skSkillNo : '',
teamMenu : '',
time : ''
},
history : {
entryDate : '',
entryImage : '',
entryInfo : '',
historyContainer : '',
historyContent : ''
},
team : {
btmContainer : '',
btmLeftContainer : '',
btmRightContainer : '',
electionsContainer : '',
electionsContent : '',
eventsContainer : '',
eventsContent : '',
guestbookContainer : '',
guestbookContent : '',
guestbookEntry : '',
guestbookEntryAuthorIs : '',
historyLink: '',
id : '',
invitesContainer : '',
invitesContent : '',
joined : '',
lastMatches : '',
logo : '',
pactsContainer : '',
pactsContent : '',
ranking : '',
topLeftContainer : '',
topRightContainer : '',
userLink : ''
},
matches : {
arcadeMatch : '',
buttons : '',
currentWeek : '',
date : '',
emptyMatch : '',
header : '',
lastMatch : '',
lastMatchAfter : '',
matchesStart : '',
matchSpace : '',
teams : '',
title : '',
weekMargin : '',
weeks : ''
},
forum : {
favoritesRow : '',
lastSection : '',
topic : '',
topicLink : '',
topicAuthor : '',
topicAuthorIs : '',
topicDate : '',
topicIDIs : '',
topicsContainer : ''
},
topic : {
btmPages : '',
currentPageNo : '',
currentPageNode : '',
forumLink : '',
post : '',
postAuthor : '',
postAuthorIs : '',
postBtns : '',
postHdr : '',
postsSet : '',
topicID : '',
topicLink : '',
topPages : ''
},
player : {
age : '',
biddingDate : '',
biddingForm : '',
biddingInput : '',
bmi : '',
data : '',
discipline : '',
form : '',
header : '',
height : '',
nameBar : '',
profile : '',
rightColumn : '',
skill : '',
skillNo : '',
skills : '',
team : '',
transferInfo : '',
val : '',
wage : '',
weight : ''
},
transfers : {
formHeader : '',
playerCell : '',
playerInfo : '',
playerMoney : '',
searchFooter : '',
searchForm : '',
searchHeader : '',
skillNo : ''
},
office : {
anncmntsContainer : '',
announcedPlayer : '',
curTransfersBody : '',
curTransfersHdr : '',
nonBorderRow : '',
notMyOffers : '',
transferBuyer : '',
transferDate : '',
transferPlayer : '',
transfersContainer : ''
},
stadium : {
changePrice : '',
construction : '',
emptyStanding : '',
leftColumn : '',
rightColumn : '',
stadiumTable : '',
standingMoney : '',
standings : '',
standingsTable : '',
standingsTypes : '',
teamLink : '',
totalPlaces : ''
},
league : {
countryLink : '',
leagueLink : '',
name : '',
navLinksCntnr : '',
round : '',
table : '',
tableTeams : ''
},
tactics : {
tacticBtns : '',
tactics : ''
},
economy : {
balance : '',
currentWeek : '',
previousWeek : ''
},
players : {
header : '',
pAge : '',
pFlag : '',
pForm : '',
player : '',
playerProfile : '',
pValue : '',
pWage : '',
teamContainer : '',
teamName : ''
},
lineup : {
formationDiv : '',
playersTab : ''
},
stats : {
formation : '',
playersTab : '',
stadiumLink : ''
},
juniors : {
headerBtns : '',
juniorsTab : '',
juniorRow : '',
trainingJuniorsHdr : ''
},
report : {
awayTeamLink : '',
homeTeamLink : '',
reportLink : '',
result : '',
spectators : '',
table : ''
}
};
// Structure containing various regular expressions used in webpage processing.
var _regexp = {
global : {
dateTime : /.*?/
},
matches : {
future : /.*?/,
match : /.*?/,
played : /.*?/,
title : /.*?/
},
forum : {
forum : /.*?/,
topic : /.*?/
},
team : {
userLogin : /.*?/
},
player : {
playerData : /.*?/
},
transfers : {
transferDate : /.*?/
}
};
// Preferences module interface for managing extension preferences.
// Should be implemented separately for each browser extension.
// The lack of get/load method here is intentional, since loading data
// from preferences is done only at page load. This is caused by the fact
// that different browsers handle their extensions preferences differently
// (in fact chrome's asynchronous calls for handling preferences made me do so).
var sk_preferences = {
save : function(key, val, afterCb) {
if (afterCb != null) {
afterCb();
}
},
remove : function(key, afterCb) {
if (afterCb != null) {
afterCb();
}
},
clear : function(afterCb) {
if (afterCb != null) {
afterCb();
}
}
};
// Checks if given site is proper. This should ensure that all those scripts
// in browser will only work on desired site which is Sokker Manager site.
function websiteOk(site) {
if (_properHosts.indexOf(site) != -1) {
return true;
} else {
return false;
}
}
(editado)
// Initialization of some global variables for extension injected scripts.
var locale = {};
var ntdb_players = {};
// Variable storing functional libraries.
var sk_libs = {};
// Icons
var _icons = {
assist : 'pic/assist.gif',
goal : 'http://files.sokker.org/pic/gool.gif',
playerCopy : 'http://www.sokker.cz/osokker/images/copy.png',
playerInjury : 'http://files.sokker.org/pic/kontuzja.gif',
playerInquiry : 'pic/ico_new_mail.gif',
redCard : 'http://files.sokker.org/pic/czerwona.gif',
shortlistAdd : 'pic/briefcase_ico.gif',
yellowCard : 'http://files.sokker.org/pic/zolta.gif'
};
// Predefined sorting kinds
var _sort = {
ASC : 'asc', // ascending sort
DESC : 'desc', // descending sort
NO : 'no' // no sorting
};
// Layout information
var _layout = {
// Current layout elements values.
background : null,
skin : null,
menu : null,
// Predefined layout elements values.
SKIN : {
OLD : 'old',
DEFAULT : 'default',
CYBORG : 'cyborg',
DARKLY : 'darkly',
LUMEN : 'lumen',
SLATE : 'slate',
SPACELAB : 'spacelab',
UNITED : 'united'
},
MENU : {
LEFT : 'left',
BOTTOM : 'bottom',
TOP : 'top'
},
// Stylesheets class declarations
classdef : {
btnIcon : '',
btnLink : '',
btnPrimary : '',
container1 : '',
container2 : '',
container3 : '',
favorite : '',
favoritesTable : '',
header : '',
linksContainerBtn : '',
popup : '',
popupDiv : '',
redBoldText : '',
table1 : '',
table2 : '',
title1 : '',
title2 : ''
},
// Style declarations
styledef : {
favoritesTable : '',
icon : '',
linksContainer : '',
linksContainerA : '',
linksContainerLi : '',
popupBorder : '',
shortlistTable : '',
teamSummaryTable : '',
xBtn : ''
},
// Colors declarations
color : {
tableBorder : ''
},
// HTML patterns declarations
html : {
button : '',
collapse : '',
expand : '',
favorite : '',
favoritesEmptyRow : '',
favoritesTable : '',
favMark : '',
hideMark : '',
hr : '',
infoMark : '',
lastPageLink : '',
linksContainerBtn : '',
noFavMark : '',
ntdbLink : '',
playerSkills : '',
playersSkills : '',
showMark : '',
showSkillsElem : '',
showSkillsInner : '',
skillNumber : '',
statsTable : '',
tacticBtnElem : '',
tacticBtnInner : '',
teamMatchesCntnr : '',
transferAlarm : ''
}
};
// Structure containing selectors for searching for various elements in webpage.
var _searcher = {
global : {
bbCodeToolbar : '',
clock : '',
generalContainer : '',
globalMenu : '',
menuContainer : '',
selectedLang : '',
skSkillNo : '',
teamMenu : '',
time : ''
},
history : {
entryDate : '',
entryImage : '',
entryInfo : '',
historyContainer : '',
historyContent : ''
},
team : {
btmContainer : '',
btmLeftContainer : '',
btmRightContainer : '',
electionsContainer : '',
electionsContent : '',
eventsContainer : '',
eventsContent : '',
guestbookContainer : '',
guestbookContent : '',
guestbookEntry : '',
guestbookEntryAuthorIs : '',
historyLink: '',
id : '',
invitesContainer : '',
invitesContent : '',
joined : '',
lastMatches : '',
logo : '',
pactsContainer : '',
pactsContent : '',
ranking : '',
topLeftContainer : '',
topRightContainer : '',
userLink : ''
},
matches : {
arcadeMatch : '',
buttons : '',
currentWeek : '',
date : '',
emptyMatch : '',
header : '',
lastMatch : '',
lastMatchAfter : '',
matchesStart : '',
matchSpace : '',
teams : '',
title : '',
weekMargin : '',
weeks : ''
},
forum : {
favoritesRow : '',
lastSection : '',
topic : '',
topicLink : '',
topicAuthor : '',
topicAuthorIs : '',
topicDate : '',
topicIDIs : '',
topicsContainer : ''
},
topic : {
btmPages : '',
currentPageNo : '',
currentPageNode : '',
forumLink : '',
post : '',
postAuthor : '',
postAuthorIs : '',
postBtns : '',
postHdr : '',
postsSet : '',
topicID : '',
topicLink : '',
topPages : ''
},
player : {
age : '',
biddingDate : '',
biddingForm : '',
biddingInput : '',
bmi : '',
data : '',
discipline : '',
form : '',
header : '',
height : '',
nameBar : '',
profile : '',
rightColumn : '',
skill : '',
skillNo : '',
skills : '',
team : '',
transferInfo : '',
val : '',
wage : '',
weight : ''
},
transfers : {
formHeader : '',
playerCell : '',
playerInfo : '',
playerMoney : '',
searchFooter : '',
searchForm : '',
searchHeader : '',
skillNo : ''
},
office : {
anncmntsContainer : '',
announcedPlayer : '',
curTransfersBody : '',
curTransfersHdr : '',
nonBorderRow : '',
notMyOffers : '',
transferBuyer : '',
transferDate : '',
transferPlayer : '',
transfersContainer : ''
},
stadium : {
changePrice : '',
construction : '',
emptyStanding : '',
leftColumn : '',
rightColumn : '',
stadiumTable : '',
standingMoney : '',
standings : '',
standingsTable : '',
standingsTypes : '',
teamLink : '',
totalPlaces : ''
},
league : {
countryLink : '',
leagueLink : '',
name : '',
navLinksCntnr : '',
round : '',
table : '',
tableTeams : ''
},
tactics : {
tacticBtns : '',
tactics : ''
},
economy : {
balance : '',
currentWeek : '',
previousWeek : ''
},
players : {
header : '',
pAge : '',
pFlag : '',
pForm : '',
player : '',
playerProfile : '',
pValue : '',
pWage : '',
teamContainer : '',
teamName : ''
},
lineup : {
formationDiv : '',
playersTab : ''
},
stats : {
formation : '',
playersTab : '',
stadiumLink : ''
},
juniors : {
headerBtns : '',
juniorsTab : '',
juniorRow : '',
trainingJuniorsHdr : ''
},
report : {
awayTeamLink : '',
homeTeamLink : '',
reportLink : '',
result : '',
spectators : '',
table : ''
}
};
// Structure containing various regular expressions used in webpage processing.
var _regexp = {
global : {
dateTime : /.*?/
},
matches : {
future : /.*?/,
match : /.*?/,
played : /.*?/,
title : /.*?/
},
forum : {
forum : /.*?/,
topic : /.*?/
},
team : {
userLogin : /.*?/
},
player : {
playerData : /.*?/
},
transfers : {
transferDate : /.*?/
}
};
// Preferences module interface for managing extension preferences.
// Should be implemented separately for each browser extension.
// The lack of get/load method here is intentional, since loading data
// from preferences is done only at page load. This is caused by the fact
// that different browsers handle their extensions preferences differently
// (in fact chrome's asynchronous calls for handling preferences made me do so).
var sk_preferences = {
save : function(key, val, afterCb) {
if (afterCb != null) {
afterCb();
}
},
remove : function(key, afterCb) {
if (afterCb != null) {
afterCb();
}
},
clear : function(afterCb) {
if (afterCb != null) {
afterCb();
}
}
};
// Checks if given site is proper. This should ensure that all those scripts
// in browser will only work on desired site which is Sokker Manager site.
function websiteOk(site) {
if (_properHosts.indexOf(site) != -1) {
return true;
} else {
return false;
}
}
(editado)
Lipa91 para
kryminator
501.lib_common.js
// ========================================================
// =================== C O M M O N ========================
sk_libs.common = {
// Returns array with URL path split by slash separator.
_splitURL : function() {
return document.location.pathname.split("/");
},
// Checks if browser is the one given in parameter by checking whether
// user agent contains given string.
_userAgent : function(bName) {
return navigator.userAgent.indexOf(bName) != -1;
},
// Gets dayt of the week from date string.
_weekday : function(date) {
var arr = date.split('-');
return new Date(parseInt(arr[0], 10),
parseInt(arr[1], 10)-1,
parseInt(arr[2], 10)).getDay();
},
// Removes element from list from preferences and from preferences by moving
// last element of list to index of removed element.
removeFromPrefs : function(key, arr, idx, cb) {
var lastIdx = arr.length-1;
var keyPfx = key + _optionSeparator;
var keyRemove = keyPfx + lastIdx + '';
var keySave = keyPfx + idx + '';
var val = {};
for (var i=0; i 0;
},
// Checks if current layout is old sokker layout.
isLayoutOld : function() {
return _layout.skin == _layout.SKIN.OLD;
},
// Checks if given list based on key contains given value.
// Returns null if given value is invalid, false if value is not in array or
// single-item array (array is needed to exclude situation when index is 0
// and some conditions would be falses then) with index of value in array
// if it is included there.
containsValue : function(key, arr, val) {
var subid = _uniques[key];
var idx = _fieldsForOption[key].indexOf(subid);
tArr = [];
for (var i=0; i 0) {
cntnr.appendChild(header);
}
if (items.length > 0) {
cntnr.appendChild(content);
}
}
return cntnr;
},
// Creates popup dialog
createPopup : function(ev, id_, args) {
// Setting default values if some arguments were not given.
onSave = args.onSave;
onCancel = args.onCancel || function(ev) {
document.body.removeChild(document.getElementById(id_));
};
onLoad = args.onLoad || function(ev) {};
labelSave = args.labelSave || _('lblSave');
labelCancel = args.labelCancel || _('lblCancel');
items = args.items || [];
buttons = args.buttons || [];
isAbove = args.isAbove || false;
isOnLeft = args.isOnLeft || false;
// Check if popup exists, if no then create it.
var divPopup = $('div#' + id_, document);
if (divPopup.length == 0) {
// Building the popup.
divPopup = document.createElement('div');
var divContent = document.createElement('div');
var divButtons = document.createElement('div');
divPopup.setAttribute('id', id_);
divPopup.setAttribute('class', _layout.classdef.popup);
divContent.setAttribute('class', _layout.classdef.popupDiv);
divButtons.setAttribute('class', _layout.classdef.popupDiv);
for (var idx in items) {
divContent.appendChild(items[idx]);
}
if (onSave) {
var btnSave = document.createElement('button');
btnSave.setAttribute('type', 'button');
btnSave.setAttribute('class', _layout.classdef.btnLink);
btnSave.setAttribute('style', 'cursor:pointer;');
btnSave.innerHTML = vsprintf(_layout.html.button, [labelSave]);
btnSave.addEventListener('click', onSave);
divButtons.appendChild(btnSave);
}
var btnCancel = document.createElement('button');
btnCancel.setAttribute('type', 'button');
btnCancel.setAttribute('class', _layout.classdef.btnLink);
btnCancel.setAttribute('style', 'cursor:pointer;');
btnCancel.innerHTML = vsprintf(_layout.html.button, [labelCancel]);
btnCancel.addEventListener('click', onCancel);
divButtons.appendChild(btnCancel);
for (var idx in buttons) {
divButtons.appendChild(buttons[idx]);
}
divPopup.appendChild(divContent);
divPopup.appendChild(divButtons);
// Set popup to be invisible to estimate its height and after that apply proper style to it.
divPopup.setAttribute('style', 'visibility:hidden;position: absolute;');
document.body.appendChild(divPopup);
} else {
divPopup = divPopup[0];
}
offsetY = isAbove ? -(divPopup.clientHeight + 20) : 0;
offsetX = isOnLeft ? -(divPopup.clientWidth + 20) : 0;
divPopup.setAttribute('style', [
_layout.styledef.popupBorder,
'border-radius: 10px;',
'top: ' + (ev.clientY + document.defaultView.scrollY + offsetY) + 'px;',
'left: ' + (ev.clientX + document.defaultView.scrollX + offsetX) + 'px;',
'padding: 10px 10px 0px 10px;',
'position: absolute;',
'z-index: 1000;'
].join(''));
onLoad();
},
// Creates flags container with built-in functionality of executing given
// callback function with locale related to clicked flag.
createFlagsDiv : function(callback, args) {
var flagsCntnr = document.createElement('div');
flagsCntnr.setAttribute('id', 'sk_flagsDiv');
flagsCntnr.setAttribute('style', 'max-width:400px;');
// Flag links for old layout
var flagLinks = $('div#indexFooterLangList li', document);
flagLinks.each(function(idx) {
var langCode = this.querySelector('a').getAttribute('href').split('/').reverse()[0];
var flagLink = vsprintf(sk_libs.player._flagPathTemplate, [this.getAttribute('flag')]);
var img = document.createElement('img');
img.setAttribute('style', 'display:inline;');
img.setAttribute('border', '0');
img.setAttribute('alt', '');
img.setAttribute('src', flagLink);
img.addEventListener('click', function(evImgClick) {
executeWithLocale(function() {
callback(args);
executeWithLocale(function() {}, null);
}, langCode);
});
flagsCntnr.appendChild(img);
});
// Flag links for new layout
var xhr = new XMLHttpRequest();
xhr.open('GET', _http('/get/part/lang_list'), true);
xhr.addEventListener('load', function(evLoad) {
if (this.readyState === 4 && this.status === 200) {
var flagLinks = $(this.responseText).find('a.btn');
var flagsCntnr = $('#sk_flagsDiv', document)[0];
flagLinks.each(function(idx) {
var langCode = this.getAttribute('href').split('/').reverse()[0];
var flagLink = this.querySelector('img')
.getAttribute('src').replace(/^https:/, 'http:');
var img = document.createElement('img');
img.setAttribute('style', 'display:inline;');
img.setAttribute('border', '0');
img.setAttribute('alt', '');
img.setAttribute('src', flagLink);
img.addEventListener('click', function(evImgClick) {
executeWithLocale(function() {
callback(args);
executeWithLocale(function() {}, null);
}, langCode);
});
flagsCntnr.appendChild(img);
});
}
});
xhr.send();
return flagsCntnr;
},
// Converts given number to formatted string representing amount of money,
// optionally with given currency.
number2Currency : function(no, curr) {
if (curr) {
curr = ' ' + curr;
} else {
curr = '';
}
if (no%1 != 0) {
no = parseInt(no);
}
return no.toString().replace(/\d(?=(\d{3})+$)/g, '$& ') + curr;
},
// ************** MAIN ***************
// Checks if current page is main page.
isTeam : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "glowna";
var test2 = arr[0] == "" && arr[1] == "team";
var test3 = arr.slice(2).indexOf("teamID") % 2 == 0;
var test4 = arr.slice(2).indexOf("userID") % 2 == 0;
return test1 || (test2 && (test3 || test4));
},
// Checks if current page is login page.
isLogon : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "logon";
return test1;
},
// Checks if current page is login page.
isLeague : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "league";
return test1;
},
// ************** FORUM **************
// Checks if current page is forum page.
isForum : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "forum";
var test2 = arr.slice(2).indexOf("ID_forum") % 2 == 0;
return test1 && test2;
},
// Checks if current page is thread page.
isThread : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "forum_topic";
var test2 = arr.slice(2).indexOf("ID_forum") % 2 == 0;
/*var test3 = arr.slice(2).indexOf("ID_topic") % 2 == 0;
var test4 = arr.slice(2).indexOf("pg") % 2 == 0;
var test5 = /\/forum_topic\/#new$/.test(document.location.href);
var test6 = arr.slice(2).indexOf("post_no") % 2 == 0;
var test7 = arr.slice(2).indexOf("action") % 2 == 0;
var test8 = /\/action\/Del\/?/.test(document.location.href);
return (test1 && test2 && test3 && test4) || (test1 && test5)
|| (test1 && test3 && test6 && test7 && test8);*/
return test1 && test2;
},
// Checks if current page is reply to post page.
isNewPost : function() {
var arr = this._splitURL();
var test1 = arr.slice(2).indexOf("post_no") % 2 == 0;
var test2 = arr.slice(2).indexOf("action");
var test3 = arr[test2 + 1] == "New";
test2 = test2 % 2 == 0;
return test1 && test2 && test3;
},
// ************** PLAYER **************
// Checks if current page is player page.
isPlayer : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "player";
var test2 = arr.slice(2).indexOf("PID") % 2 == 0;
return test1 && test2;
},
// ************** PLAYERS **************
// Checks if current page is players page.
isPlayers : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "players";
var test2 = arr[0] == "" && arr[1] == "players.php";
return test1 || test2;
},
// ************** JUNIORS **************
// Checks if current page is juniors page.
isJuniors : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "juniors";
return test1;
},
// ************** TRANSFERS **************
// Checks if current page is transfers page.
isTransfers : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "transfers";
var test2 = /\/action\/showlast\/?/.test(document.location.href);
return test1 && !test2;
},
// Checks if current page is transfer search page.
isTransferSearch : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "transferSearch";
return test1;
},
// Loads main transfers page.
loadTransfers : function() {
document.location.href = _http('/transfers');
},
// ************** OFFICE **************
// Checks if current page is main office page.
isOffice : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "office";
return test1;
},
// Loads main office page.
loadOffice : function() {
document.location.href = _http('/office');
},
// ************** MATCHES **************
// Checks if current page is matches page.
isMatches : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "matches";
return test1;
},
// Checks if current page is studio page.
isStudio : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "studio";
var test2 = arr.slice(2).indexOf("matchID") % 2 == 0;
return test1 && test2;
},
// Checks if current page is match report/comment page.
isReport : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "comment";
var test2 = arr.slice(2).indexOf("matchID") % 2 == 0;
return test1 && test2;
},
// Checks if current page is match view page.
isMatchView : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "matchview.php";
return test1;
},
// Checks if current page is match video page.
isMatchVideo : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "match_video";
return test1;
},
// Checks if current page is match statistics page.
isMatchStats : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "stats";
var test2 = arr.slice(2).indexOf("matchID") % 2 == 0;
var test3 = arr.slice(2).indexOf("teamID") % 2 == 0;
return test1 && test2 && test3;
},
// ************** HISTORY **************
// Checks if current page is club history page.
isHistory : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "history_team";
var test2 = arr.slice(2).indexOf("teamID") % 2 == 0;
return test1 && test2;
},
// ************** STADIUM **************
// Checks if current page is club stadium page.
isStadium : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "arena";
return test1;
},
// Checks if current page is user`s club stadium page.
isUserStadium : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "arena";
var test2 = arr.length == 2;
var test3 = $(_searcher.stadium.changePrice, document).length > 0;
var test4 = $(_searcher.stadium.construction, document).length > 0;
return test1 && (test2 || (test3 && test4));
},
// Loads user stadium page.
loadUserStadium : function() {
document.location.href = _http('/arena');
},
// ************** TACTICS **************
// Checks if current page is tactic edit page.
isTacticEdit : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "tactedit";
return test1;
},
// ************** ECONOMY **************
// Checks if current page is club economy page.
isEconomy : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "economy";
return test1;
},
// ************** LINE-UP **************
// Checks if current page is line-up page.
isLineup : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "lineup";
var test2 = arr.slice(2).indexOf("matchID") % 2 == 0;
var test3 = arr.slice(2).indexOf("squadform") % 2 == 1;
var test4 = arr.length == 4;
return test1 && test2 && (test3 || test4);
}
};
// ========================================================
// =================== C O M M O N ========================
sk_libs.common = {
// Returns array with URL path split by slash separator.
_splitURL : function() {
return document.location.pathname.split("/");
},
// Checks if browser is the one given in parameter by checking whether
// user agent contains given string.
_userAgent : function(bName) {
return navigator.userAgent.indexOf(bName) != -1;
},
// Gets dayt of the week from date string.
_weekday : function(date) {
var arr = date.split('-');
return new Date(parseInt(arr[0], 10),
parseInt(arr[1], 10)-1,
parseInt(arr[2], 10)).getDay();
},
// Removes element from list from preferences and from preferences by moving
// last element of list to index of removed element.
removeFromPrefs : function(key, arr, idx, cb) {
var lastIdx = arr.length-1;
var keyPfx = key + _optionSeparator;
var keyRemove = keyPfx + lastIdx + '';
var keySave = keyPfx + idx + '';
var val = {};
for (var i=0; i 0;
},
// Checks if current layout is old sokker layout.
isLayoutOld : function() {
return _layout.skin == _layout.SKIN.OLD;
},
// Checks if given list based on key contains given value.
// Returns null if given value is invalid, false if value is not in array or
// single-item array (array is needed to exclude situation when index is 0
// and some conditions would be falses then) with index of value in array
// if it is included there.
containsValue : function(key, arr, val) {
var subid = _uniques[key];
var idx = _fieldsForOption[key].indexOf(subid);
tArr = [];
for (var i=0; i 0) {
cntnr.appendChild(header);
}
if (items.length > 0) {
cntnr.appendChild(content);
}
}
return cntnr;
},
// Creates popup dialog
createPopup : function(ev, id_, args) {
// Setting default values if some arguments were not given.
onSave = args.onSave;
onCancel = args.onCancel || function(ev) {
document.body.removeChild(document.getElementById(id_));
};
onLoad = args.onLoad || function(ev) {};
labelSave = args.labelSave || _('lblSave');
labelCancel = args.labelCancel || _('lblCancel');
items = args.items || [];
buttons = args.buttons || [];
isAbove = args.isAbove || false;
isOnLeft = args.isOnLeft || false;
// Check if popup exists, if no then create it.
var divPopup = $('div#' + id_, document);
if (divPopup.length == 0) {
// Building the popup.
divPopup = document.createElement('div');
var divContent = document.createElement('div');
var divButtons = document.createElement('div');
divPopup.setAttribute('id', id_);
divPopup.setAttribute('class', _layout.classdef.popup);
divContent.setAttribute('class', _layout.classdef.popupDiv);
divButtons.setAttribute('class', _layout.classdef.popupDiv);
for (var idx in items) {
divContent.appendChild(items[idx]);
}
if (onSave) {
var btnSave = document.createElement('button');
btnSave.setAttribute('type', 'button');
btnSave.setAttribute('class', _layout.classdef.btnLink);
btnSave.setAttribute('style', 'cursor:pointer;');
btnSave.innerHTML = vsprintf(_layout.html.button, [labelSave]);
btnSave.addEventListener('click', onSave);
divButtons.appendChild(btnSave);
}
var btnCancel = document.createElement('button');
btnCancel.setAttribute('type', 'button');
btnCancel.setAttribute('class', _layout.classdef.btnLink);
btnCancel.setAttribute('style', 'cursor:pointer;');
btnCancel.innerHTML = vsprintf(_layout.html.button, [labelCancel]);
btnCancel.addEventListener('click', onCancel);
divButtons.appendChild(btnCancel);
for (var idx in buttons) {
divButtons.appendChild(buttons[idx]);
}
divPopup.appendChild(divContent);
divPopup.appendChild(divButtons);
// Set popup to be invisible to estimate its height and after that apply proper style to it.
divPopup.setAttribute('style', 'visibility:hidden;position: absolute;');
document.body.appendChild(divPopup);
} else {
divPopup = divPopup[0];
}
offsetY = isAbove ? -(divPopup.clientHeight + 20) : 0;
offsetX = isOnLeft ? -(divPopup.clientWidth + 20) : 0;
divPopup.setAttribute('style', [
_layout.styledef.popupBorder,
'border-radius: 10px;',
'top: ' + (ev.clientY + document.defaultView.scrollY + offsetY) + 'px;',
'left: ' + (ev.clientX + document.defaultView.scrollX + offsetX) + 'px;',
'padding: 10px 10px 0px 10px;',
'position: absolute;',
'z-index: 1000;'
].join(''));
onLoad();
},
// Creates flags container with built-in functionality of executing given
// callback function with locale related to clicked flag.
createFlagsDiv : function(callback, args) {
var flagsCntnr = document.createElement('div');
flagsCntnr.setAttribute('id', 'sk_flagsDiv');
flagsCntnr.setAttribute('style', 'max-width:400px;');
// Flag links for old layout
var flagLinks = $('div#indexFooterLangList li', document);
flagLinks.each(function(idx) {
var langCode = this.querySelector('a').getAttribute('href').split('/').reverse()[0];
var flagLink = vsprintf(sk_libs.player._flagPathTemplate, [this.getAttribute('flag')]);
var img = document.createElement('img');
img.setAttribute('style', 'display:inline;');
img.setAttribute('border', '0');
img.setAttribute('alt', '');
img.setAttribute('src', flagLink);
img.addEventListener('click', function(evImgClick) {
executeWithLocale(function() {
callback(args);
executeWithLocale(function() {}, null);
}, langCode);
});
flagsCntnr.appendChild(img);
});
// Flag links for new layout
var xhr = new XMLHttpRequest();
xhr.open('GET', _http('/get/part/lang_list'), true);
xhr.addEventListener('load', function(evLoad) {
if (this.readyState === 4 && this.status === 200) {
var flagLinks = $(this.responseText).find('a.btn');
var flagsCntnr = $('#sk_flagsDiv', document)[0];
flagLinks.each(function(idx) {
var langCode = this.getAttribute('href').split('/').reverse()[0];
var flagLink = this.querySelector('img')
.getAttribute('src').replace(/^https:/, 'http:');
var img = document.createElement('img');
img.setAttribute('style', 'display:inline;');
img.setAttribute('border', '0');
img.setAttribute('alt', '');
img.setAttribute('src', flagLink);
img.addEventListener('click', function(evImgClick) {
executeWithLocale(function() {
callback(args);
executeWithLocale(function() {}, null);
}, langCode);
});
flagsCntnr.appendChild(img);
});
}
});
xhr.send();
return flagsCntnr;
},
// Converts given number to formatted string representing amount of money,
// optionally with given currency.
number2Currency : function(no, curr) {
if (curr) {
curr = ' ' + curr;
} else {
curr = '';
}
if (no%1 != 0) {
no = parseInt(no);
}
return no.toString().replace(/\d(?=(\d{3})+$)/g, '$& ') + curr;
},
// ************** MAIN ***************
// Checks if current page is main page.
isTeam : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "glowna";
var test2 = arr[0] == "" && arr[1] == "team";
var test3 = arr.slice(2).indexOf("teamID") % 2 == 0;
var test4 = arr.slice(2).indexOf("userID") % 2 == 0;
return test1 || (test2 && (test3 || test4));
},
// Checks if current page is login page.
isLogon : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "logon";
return test1;
},
// Checks if current page is login page.
isLeague : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "league";
return test1;
},
// ************** FORUM **************
// Checks if current page is forum page.
isForum : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "forum";
var test2 = arr.slice(2).indexOf("ID_forum") % 2 == 0;
return test1 && test2;
},
// Checks if current page is thread page.
isThread : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "forum_topic";
var test2 = arr.slice(2).indexOf("ID_forum") % 2 == 0;
/*var test3 = arr.slice(2).indexOf("ID_topic") % 2 == 0;
var test4 = arr.slice(2).indexOf("pg") % 2 == 0;
var test5 = /\/forum_topic\/#new$/.test(document.location.href);
var test6 = arr.slice(2).indexOf("post_no") % 2 == 0;
var test7 = arr.slice(2).indexOf("action") % 2 == 0;
var test8 = /\/action\/Del\/?/.test(document.location.href);
return (test1 && test2 && test3 && test4) || (test1 && test5)
|| (test1 && test3 && test6 && test7 && test8);*/
return test1 && test2;
},
// Checks if current page is reply to post page.
isNewPost : function() {
var arr = this._splitURL();
var test1 = arr.slice(2).indexOf("post_no") % 2 == 0;
var test2 = arr.slice(2).indexOf("action");
var test3 = arr[test2 + 1] == "New";
test2 = test2 % 2 == 0;
return test1 && test2 && test3;
},
// ************** PLAYER **************
// Checks if current page is player page.
isPlayer : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "player";
var test2 = arr.slice(2).indexOf("PID") % 2 == 0;
return test1 && test2;
},
// ************** PLAYERS **************
// Checks if current page is players page.
isPlayers : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "players";
var test2 = arr[0] == "" && arr[1] == "players.php";
return test1 || test2;
},
// ************** JUNIORS **************
// Checks if current page is juniors page.
isJuniors : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "juniors";
return test1;
},
// ************** TRANSFERS **************
// Checks if current page is transfers page.
isTransfers : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "transfers";
var test2 = /\/action\/showlast\/?/.test(document.location.href);
return test1 && !test2;
},
// Checks if current page is transfer search page.
isTransferSearch : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "transferSearch";
return test1;
},
// Loads main transfers page.
loadTransfers : function() {
document.location.href = _http('/transfers');
},
// ************** OFFICE **************
// Checks if current page is main office page.
isOffice : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "office";
return test1;
},
// Loads main office page.
loadOffice : function() {
document.location.href = _http('/office');
},
// ************** MATCHES **************
// Checks if current page is matches page.
isMatches : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "matches";
return test1;
},
// Checks if current page is studio page.
isStudio : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "studio";
var test2 = arr.slice(2).indexOf("matchID") % 2 == 0;
return test1 && test2;
},
// Checks if current page is match report/comment page.
isReport : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "comment";
var test2 = arr.slice(2).indexOf("matchID") % 2 == 0;
return test1 && test2;
},
// Checks if current page is match view page.
isMatchView : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "matchview.php";
return test1;
},
// Checks if current page is match video page.
isMatchVideo : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "match_video";
return test1;
},
// Checks if current page is match statistics page.
isMatchStats : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "stats";
var test2 = arr.slice(2).indexOf("matchID") % 2 == 0;
var test3 = arr.slice(2).indexOf("teamID") % 2 == 0;
return test1 && test2 && test3;
},
// ************** HISTORY **************
// Checks if current page is club history page.
isHistory : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "history_team";
var test2 = arr.slice(2).indexOf("teamID") % 2 == 0;
return test1 && test2;
},
// ************** STADIUM **************
// Checks if current page is club stadium page.
isStadium : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "arena";
return test1;
},
// Checks if current page is user`s club stadium page.
isUserStadium : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "arena";
var test2 = arr.length == 2;
var test3 = $(_searcher.stadium.changePrice, document).length > 0;
var test4 = $(_searcher.stadium.construction, document).length > 0;
return test1 && (test2 || (test3 && test4));
},
// Loads user stadium page.
loadUserStadium : function() {
document.location.href = _http('/arena');
},
// ************** TACTICS **************
// Checks if current page is tactic edit page.
isTacticEdit : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "tactedit";
return test1;
},
// ************** ECONOMY **************
// Checks if current page is club economy page.
isEconomy : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "economy";
return test1;
},
// ************** LINE-UP **************
// Checks if current page is line-up page.
isLineup : function() {
var arr = this._splitURL();
var test1 = arr[0] == "" && arr[1] == "lineup";
var test2 = arr.slice(2).indexOf("matchID") % 2 == 0;
var test3 = arr.slice(2).indexOf("squadform") % 2 == 1;
var test4 = arr.length == 4;
return test1 && test2 && (test3 || test4);
}
};