Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
flatsiedatsie committed Jul 14, 2022
1 parent 095de88 commit a1e172e
Show file tree
Hide file tree
Showing 6 changed files with 206 additions and 80 deletions.
89 changes: 60 additions & 29 deletions css/extension.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,39 @@
margin:0 auto;
}

#extension-candleappstore-view {
height: 100vh; /*calc(100% - 7.6rem);*/
box-sizing: border-box;
overflow: auto;
/*
position: absolute;
top: 7.6rem;
left: 0;
*/
padding: 2rem;
}


#extension-candleappstore-content {
display:flex;
flex-direction: column;
overflow: auto;
/*position: relative;*/
text-align: left;
font-size: 1.6rem;
color: #fff;
height:auto;
max-width: 100rem;
margin: 0 auto;
}

#extension-candleappstore-content img{
max-width:100%;
}




.extension-candleappstore-selected-description{
font-style:italic;
margin-top:1rem;
Expand Down Expand Up @@ -113,13 +146,17 @@
flex-grow: 1;
}

#extension-hotspot-debug-warning,
.extension-candleappstore-vlak{
background-color:rgba(0,0,0,.1);
padding:2rem;
box-sizing:border-box;
margin:2rem 0;
}

#extension-hotspot-debug-warning{
background-color:red;
}

.extension-candleappstore-vlak.extension-candleappstore-basic-info > *{
display:block;
Expand Down Expand Up @@ -281,6 +318,9 @@
.extension-candleappstore-basic-description{
opacity:.8;
}
.extension-candleappstore-basic-description > p{
line-height:2.2rem;
}

#extension-candleappstore-list .extension-candleappstore-item{
margin-top:4rem;
Expand Down Expand Up @@ -779,35 +819,6 @@ body:not(.developer) #extension-candleappstore-show-advanced-settings-button + d
background-image: url('../images/menu-icon.svg');
}

#extension-candleappstore-view {
height: 100%; /*calc(100% - 7.6rem);*/
box-sizing: border-box;
overflow: auto;
/*
position: absolute;
top: 7.6rem;
left: 0;
*/
padding: 2rem;
}


#extension-candleappstore-content {
display:flex;
flex-direction: column;
overflow: auto;
/*position: relative;*/
text-align: left;
font-size: 1.6rem;
color: #fff;
height:auto;
max-width: 100rem;
margin: 0 auto;
}

#extension-candleappstore-content img{
max-width:100%;
}

.extension-candleappstore-response-data{
text-align:center;
Expand Down Expand Up @@ -965,8 +976,28 @@ body:not(.developer) #extension-candleappstore-show-advanced-settings-button + d
}


/* BROKEN ADDONS */

#extension-candleappstore-broken-addons-container{
margin-top:6rem;
}

.extension-candleappstore-broken-addon-item{
background-color:red;
color:white;
border-radius:.5rem;
margin:1rem 0;
padding:1rem 2rem;
cursor:pointer;
opacity:.8;
}
.extension-candleappstore-broken-addon-item:hover{
opacity:1;
}

#extension-candleappstore-broken-addons-tip{
text-align:center;
}



Expand Down
96 changes: 78 additions & 18 deletions js/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
this.permissions = {};
this.received_cloud_data = false;
this.updating_all = false;
this.disable_uninstall = false;

fetch(`/extensions/${this.id}/views/content.html`)
.then((res) => res.text())
Expand Down Expand Up @@ -120,12 +119,6 @@
}
}

if(typeof body.disable_uninstall != 'undefined'){
if(body.disable_uninstall){
this.disable_uninstall = true;
}
}

// Make sure menu button is always visible. Can be hidden if the user returns from a complex addon settings page using their browser's back button.
//document.getElementById('menu-button').classList.remove('hidden');

Expand Down Expand Up @@ -766,7 +759,7 @@
console.log("manual addon install button clicked");

if(this.exhibit_mode){
alert("cannot install, exhibit mode is active");
alert("Sorry, cannot install, exhibit mode is active");
return;
}

Expand Down Expand Up @@ -888,6 +881,7 @@

if(this.exhibit_mode){
console.log("reviews cannot be added while in exhibit mode");
alert("Sorry, reviews cannot be added in exhibit mode");
return;
}

Expand Down Expand Up @@ -978,16 +972,18 @@
// SHOP FILTERS
//

document.getElementById('extension-candleappstore-filter-search-input').addEventListener('input', (event) => {
document.getElementById('extension-candleappstore-filter-search-input').addEventListener('keyup', (event) => {
console.log('search input changed');
this.generate_overview('shop');
});

document.getElementById('extension-candleappstore-filter-search-input').addEventListener('blur', (event) => {
console.log('search input blurred');
this.generate_overview('shop');
});



document.getElementById('extension-candleappstore-filter-privacy-select').addEventListener('change', (event) => {
//console.log('privacy filter changed');
this.generate_overview('shop');
Expand All @@ -1003,6 +999,19 @@
this.generate_overview('shop');
});

document.getElementById('extension-candleappstore-broken-addons-list').addEventListener('click', (event) => {
//console.log('event.target', event.target);

if(typeof event.target.dataset.addon_id != 'undefined'){
//console.log("addon_id: ", event.target.dataset.addon_id);
event.target.style.display = 'none';
this.manual_uninstall(event.target.dataset.addon_id);
}

});



// Useful info about the system and what addons it may be able to install
/*
window.API.getAddonsInfo()
Expand Down Expand Up @@ -1147,7 +1156,7 @@
else{
//console.log("asking for data from the cloud");
// Get data for apps overview
this.get_data("get_apps.php").then(response => {
this.get_data("get_apps.json").then(response => {
//console.log(" GET ALL APPS from CLOUD response:");
//console.log(response);

Expand Down Expand Up @@ -1177,7 +1186,7 @@
else{
//console.log("asking for data from the cloud");
// Get data for apps overview
this.get_data("get_apps.php").then(response => {
this.get_data("get_apps.json").then(response => {
//console.log(" GET ALL APPS from CLOUD response:");
//console.log(response);

Expand Down Expand Up @@ -1442,11 +1451,11 @@


update_loop(){
console.log("in update_loop");
//console.log("in update_loop");
if(this.addons_to_update.length > 0 ){

const random_addon_id_index = Math.floor(Math.random() * this.addons_to_update.length);
console.log('random_addon_id_index: ', random_addon_id_index);
//console.log('random_addon_id_index: ', random_addon_id_index);
const cloud_addon_data = this.get_cloud_addon_data(this.addons_to_update[random_addon_id_index]);
if(cloud_addon_data != null){
window.API.updateAddon( cloud_addon_data.addon_id, cloud_addon_data.download_url, cloud_addon_data.checksum )
Expand All @@ -1468,7 +1477,7 @@
//}
}
else{
console.log('on to the next addon.');
//console.log('on to the next addon.');
this.generate_overview('updates');
this.update_loop();
}
Expand Down Expand Up @@ -2283,9 +2292,23 @@
}
}

// Show list of broken addons
if(not_shown_addons_list.length > 0){
console.log("not_shown_addons_list: ", not_shown_addons_list);

document.getElementById('extension-candleappstore-broken-addons-list').innerHTML = "";

for(var b = 0; b < not_shown_addons_list.length; b++){
var broken_item_el = document.createElement('div');
broken_item_el.appendChild(document.createTextNode("Delete " + not_shown_addons_list[b]));
broken_item_el.classList.add('extension-candleappstore-broken-addon-item');
broken_item_el.dataset.addon_id = not_shown_addons_list[b];
document.getElementById('extension-candleappstore-broken-addons-list').appendChild(broken_item_el);
}
document.getElementById('extension-candleappstore-broken-addons-container').style.display = 'block';



/*
// Enabling this creates a loop
this.get_installed_addons_data()
Expand Down Expand Up @@ -2323,7 +2346,9 @@
*/

}

else{
document.getElementById('extension-candleappstore-broken-addons-container').style.display = "none";
}



Expand Down Expand Up @@ -2383,6 +2408,31 @@



manual_uninstall(addon_id){
// remove data dir
if(this.debug){
console.log("will try to manually uninstall addon: ", addon_id);
}
window.API.postJson(
`/extensions/candleappstore/api/ajax`,
{'action':'uninstall','addon_id':addon_id}
)
.then((body) => {
if(this.debug){
console.log("Manual uninstall: removed addon? ", body);
}
if(typeof body.addon_dirs != 'undefined'){
this.installed = body.addon_dirs;
}
document.getElementById('extension-candleappstore-broken-addons-tip').style.display = 'block';

})
.catch((e) => {
console.log("candleappstore: error calling manually delete addon: ", e);
});
}





Expand Down Expand Up @@ -2704,6 +2754,7 @@

if(this.exhibit_mode){
console.log("not installing - exhibit mode active");
alert("Sorry, cannot install while in exhibit mode");
return;
}

Expand Down Expand Up @@ -2796,7 +2847,7 @@

else if( installed && data['versions'][v]["addon_id"] != undefined ){

if(data['versions'][v]["addon_id"] != 'candleappstore' && this.disable_uninstall == false){
if(data['versions'][v]["addon_id"] != 'candleappstore'){

var b = document.createElement("button");
b.classList.add('extension-candleappstore-selected-uninstall-button');
Expand All @@ -2810,7 +2861,12 @@
event.stopImmediatePropagation();
//console.log( data['versions'][v]["addon_id"] );

if(this.exhibit_mode){return;}
if(this.exhibit_mode){
console.log("Cannot uninstall while in exhibit mode");
alert("Sorry, cannot uninstall while in exhibit mode");
return;

}

const addon_id = data['versions'][v]["addon_id"];

Expand Down Expand Up @@ -3829,7 +3885,11 @@
//console.log(event);
event.stopImmediatePropagation();

if(this.exhibit_mode){return;}
if(this.exhibit_mode){
console.log("Cannot change settings while in exhibit mode");
alert("Sorry, cannot change settings while in exhibit mode");
return;
}

//const addon_id = data[i]["addon_id"];

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}
},
"short_name": "candleapps",
"version": "0.4.15",
"version": "0.4.16",
"web_accessible_resources": [
"css/*.css",
"images/*.svg",
Expand Down
Loading

0 comments on commit a1e172e

Please sign in to comment.