This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
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 #7547 from crdlc/bug-829050
Bug 829050 - Add a config preference to allow disabling of e.me altogeth...(cherry picked from commit 050df3e)
- Loading branch information
Showing
9 changed files
with
156 additions
and
76 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 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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
'use strict'; | ||
|
||
const Configurator = (function() { | ||
var conf = {}; | ||
|
||
var dummyProvider = { | ||
init: function() { | ||
// Do nothing | ||
}, | ||
|
||
destroy: function() { | ||
// Do nothing | ||
} | ||
} | ||
|
||
var xhr = new XMLHttpRequest(); | ||
xhr.overrideMimeType('application/json'); | ||
xhr.open('GET', 'js/init.json', true); | ||
xhr.send(null); | ||
|
||
xhr.onload = function _xhrOnLoad(evt) { | ||
try { | ||
conf = JSON.parse(xhr.responseText); | ||
|
||
var searchPage = conf.search_page; | ||
if (searchPage) { | ||
var provider = window[searchPage.provider] || dummyProvider; | ||
if (searchPage.enabled) { | ||
provider.init(); | ||
Homescreen.init(1); | ||
} else { | ||
startHomescreenByDefault(); | ||
setTimeout(provider.destroy, 0); | ||
} | ||
} | ||
} catch (e) { | ||
console.error('Failed parsing homescreen configuration file: ' + e); | ||
startHomescreenByDefault(); | ||
} | ||
} | ||
|
||
xhr.onerror = function _xhrOnError(evt) { | ||
console.error('File not found: js/init.json'); | ||
startHomescreenByDefault(); | ||
} | ||
|
||
function startHomescreenByDefault() { | ||
var searchPage = document.querySelector('div[role="search-page"]'); | ||
searchPage.parentNode.removeChild(searchPage); | ||
Homescreen.init(0); | ||
} | ||
|
||
return { | ||
getSection: function(section) { | ||
return conf[section]; | ||
} | ||
} | ||
}()); |
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
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