-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from joelthorner/dev
Fixing bugs
- Loading branch information
Showing
8 changed files
with
71 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var DEFAULTS = { | ||
optBgLc : "https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=35464e00bbef1a93e6958980d587acb5&auto=format&fit=crop&w=1950&q=80", | ||
optProfilePhoto : "../../img/iceberg.svg" | ||
} | ||
|
||
// init options ------------------------------------------------------------------------------------------------ | ||
chrome.storage.sync.get(['optBgLc'], function(result) { | ||
if ($.type(result.optBgLc) == 'undefined'){ | ||
var value = $('#opt-bg-lc').val(); | ||
if ($.type(value) == 'undefined') value = DEFAULTS.optBgLc; | ||
|
||
chrome.storage.sync.set({optBgLc: value }, function() { }); | ||
}else{ | ||
$('#opt-bg-lc').val(result.optBgLc); | ||
} | ||
}); | ||
chrome.storage.sync.get(['optProfilePhoto'], function(result) { | ||
if ($.type(result.optProfilePhoto) == 'undefined') { | ||
var value = $('.opt-profile-set.selected img').attr('src'); | ||
if ($.type(value) == 'undefined') value = DEFAULTS.optProfilePhoto; | ||
|
||
chrome.storage.sync.set({optProfilePhoto: value }, function() {}); | ||
}else{ | ||
if ($('#options-body').length) { | ||
$('#options-body .opt-profile-set').removeClass('selected'); | ||
$('#options-body img[src="'+result.optProfilePhoto+'"]').parents('button').addClass('selected'); | ||
} | ||
} | ||
}); | ||
// end init options -------------------------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,46 @@ | ||
chrome.extension.sendMessage({}, function(response) { | ||
var readyStateCheckInterval = setInterval(function() { | ||
if (document.readyState === "complete") { | ||
clearInterval(readyStateCheckInterval); | ||
if (document.readyState === "complete") { | ||
clearInterval(readyStateCheckInterval); | ||
|
||
// ---------------------------------------------------------- | ||
// This part of the script triggers when page is done loading | ||
// console.log("Hello. This message was sent from scripts/inject.js"); | ||
if (document.getElementById("SML_osUtils")) { | ||
document.getElementById("SML_osUtils").click(); | ||
|
||
function findAncestor (el, cls) { | ||
while ((el = el.parentElement) && !el.classList.contains(cls)); | ||
return el; | ||
} | ||
|
||
setTimeout(function(){ | ||
var _window = findAncestor(document.querySelector('properties[data*="opensaasUtils"]'), 'window') | ||
if (_window) { | ||
_window.classList.add('opensaasWindow'); | ||
var img = ""; | ||
chrome.storage.sync.get(['optBgLc'], function(result) { | ||
console.log(result.optBgLc); | ||
img = result.optBgLc; | ||
|
||
var n=document.createElement("style"),t=document.createTextNode('body{height: calc(100% - 40px);}#windowContainer{top:40px;}.opensaasWindow .windowButtons,.opensaasWindow .windowTitle>span{display:none}.opensaasWindow.window{position:fixed;top:0!important;left:0!important;right:0!important;height:40px!important;border:0}.opensaasWindow.window div.titleBar{background-color:#333}.opensaasWindow.window input.green{position:fixed;top:3px;left:42px;height:34px;border-radius:0;padding-left:0;padding-right:0;width:140px;transition:all 150ms ease;background-color:#222;padding-top:7px}.opensaasWindow.window input.green:hover{background-color:#444}.opensaasWindow.window input.green.__updateCacheProducts__{left:185px}.opensaasWindow.window input.green.__updateCacheCategories__{left:328px}.opensaasWindow.window input.green.__reloadApps__{left:471px}.opensaasWindow.window input.green.__reloadEvents__{left:614px}.opensaasWindow.window input.green.__downloadProjectCode__{left:auto;right:3px;width:34px;padding-top:3px}.opensaasWindow div.windowContent{height:0}.messageBox [value=No]{margin-left:0}.messageBox input[value="Sí"],.messageBox input[value=OK]{width:180px;height:50px;display:block;margin:0 auto 10px;clear:both;float:none;margin-left:auto!important}body{background-image: url('+img+');background-size: cover}.messageBox{top:0!important;left:0!important}.lastposts{display:none !important;}'); | ||
n.appendChild(t); | ||
_window.append(n); | ||
document.getElementById("windowContainer").after( | ||
document.querySelector(".opensaasWindow") | ||
); | ||
document.querySelector(".opensaasWindow.window input.green.__downloadProjectCode__").value="↓"; | ||
}); | ||
// LC inject ---------------------------------------------------------------- | ||
if (document.getElementById("SML_osUtils")) { | ||
document.getElementById("SML_osUtils").click(); | ||
|
||
function findAncestor (el, cls) { | ||
while ((el = el.parentElement) && !el.classList.contains(cls)); | ||
return el; | ||
} | ||
}, 1000); | ||
} | ||
|
||
setTimeout(function(){ | ||
var _window = findAncestor(document.querySelector('properties[data*="opensaasUtils"]'), 'window') | ||
if (_window) { | ||
_window.classList.add('opensaasWindow'); | ||
|
||
$('[ls="opensaas.utilCleanCacheCode"]').val('FLUSH'); | ||
$('[ls="opensaas.utilUpdateCacheProducts"]').val('PROD UPDATE'); | ||
$('[ls="opensaas.utilUpdateCacheCategories"]').val('CAT UPDATE'); | ||
$('[ls="opensaas.utilReloadApps"]').val('APP UPDATE'); | ||
$('[ls="opensaas.utilReloadEvents"]').val('EVENT UPDATE'); | ||
|
||
// ,setTimeout(function(){for(var e=document.querySelector('properties[data*="opensaasUtils"]'), | ||
// o=[];e=e.parentElement.closest(".window");) | ||
// o.push(e);o[0].addClass("opensaasWindow"); | ||
var img = ""; | ||
chrome.storage.sync.get(['optBgLc'], function(result) { | ||
img = result.optBgLc; | ||
|
||
// ---------------------------------------------------------- | ||
var n=document.createElement("style"),t=document.createTextNode('body{height: calc(100% - 40px);}#windowContainer{top:40px;}.opensaasWindow .windowButtons,.opensaasWindow .windowTitle>span{display:none}.opensaasWindow.window{position:fixed;top:0!important;left:0!important;right:0!important;height:40px!important;border:0}.opensaasWindow.window div.titleBar{background-color:#333}.opensaasWindow.window input.green{position:fixed;top:3px;left:42px;height:34px;border-radius:0;padding-left:0;padding-right:0;width:140px;transition:all 150ms ease;background-color:#222;padding-top:7px}.opensaasWindow.window input.green:hover{background-color:#444}.opensaasWindow.window input.green.__updateCacheProducts__{left:185px}.opensaasWindow.window input.green.__updateCacheCategories__{left:328px}.opensaasWindow.window input.green.__reloadApps__{left:471px}.opensaasWindow.window input.green.__reloadEvents__{left:614px}.opensaasWindow.window input.green.__downloadProjectCode__{left:auto;right:3px;width:34px;padding-top:3px}.opensaasWindow div.windowContent{height:0}.messageBox [value=No]{margin-left:0}.messageBox input[value="Sí"],.messageBox input[value=OK]{width:180px;height:50px;display:block;margin:0 auto 10px;clear:both;float:none;margin-left:auto!important}body{background-image: url('+img+');background-size: cover}.messageBox{top:0!important;left:0!important}.lastposts{display:none !important;}'); | ||
n.appendChild(t); | ||
_window.append(n); | ||
document.getElementById("windowContainer").after( | ||
document.querySelector(".opensaasWindow") | ||
); | ||
document.querySelector(".opensaasWindow.window input.green.__downloadProjectCode__").value="↓"; | ||
$('.taskMenuLink').first().remove(); | ||
}); | ||
} | ||
}, 1000); | ||
} | ||
// LC inject ---------------------------------------------------------------- | ||
|
||
} | ||
} | ||
}, 10); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters