diff options
Diffstat (limited to 'js/about.js')
-rw-r--r-- | js/about.js | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/js/about.js b/js/about.js index b27cb7e..3203b98 100644 --- a/js/about.js +++ b/js/about.js @@ -27,95 +27,7 @@ uDom.onLoad(function() { /******************************************************************************/ -var updateList = {}; -var assetListSwitches = ['o', 'o', 'o']; -var commitHistoryURLPrefix = 'https://github.com/gorhill/ublock/commits/master/'; - -/******************************************************************************/ - -var setAssetListClassBit = function(bit, state) { - assetListSwitches[assetListSwitches.length-1-bit] = !state ? 'o' : 'x'; - uDom('#assetList') - .removeClass() - .addClass(assetListSwitches.join('')); -}; - -/******************************************************************************/ - -var renderAssetList = function(details) { - var dirty = false; - var paths = Object.keys(details.list).sort(); - if ( paths.length > 0 ) { - uDom('#assetList .assetEntry').remove(); - var i = 0; - var path, status, html = []; - while ( path = paths[i++] ) { - status = details.list[path].status; - dirty = dirty || status !== 'Unchanged'; - html.push( - '<tr class="assetEntry ' + status.toLowerCase().replace(/ +/g, '-') + '">', - '<td>', - '<a href="' + commitHistoryURLPrefix + path + '">', - path.replace(/^(assets\/[^/]+\/)(.+)$/, '$1<b>$2</b>'), - '</a>', - '<td>', - chrome.i18n.getMessage('aboutAssetsUpdateStatus' + status) - ); - } - uDom('#assetList table tBody').append(html.join('')); - uDom('#assetList a').attr('target', '_blank'); - updateList = details.list; - } - setAssetListClassBit(0, paths.length !== 0); - setAssetListClassBit(1, dirty); - setAssetListClassBit(2, false); -}; - -/******************************************************************************/ - -var updateAssets = function() { - setAssetListClassBit(2, true); - var onDone = function(details) { - if ( details.changedCount !== 0 ) { - messaging.tell({ what: 'loadUpdatableAssets' }); - } - }; - messaging.ask({ what: 'launchAssetUpdater', list: updateList }, onDone); -}; - -/******************************************************************************/ - -var updateAssetsList = function() { - messaging.ask({ what: 'getAssetUpdaterList' }, renderAssetList); -}; - -/******************************************************************************/ - -// Updating all assets could be done from elsewhere and if so the -// list here needs to be updated. - -var onAnnounce = function(msg) { - switch ( msg.what ) { - case 'allLocalAssetsUpdated': - updateAssetsList(); - break; - - default: - break; - } -}; - -messaging.start('about.js'); -messaging.listen(onAnnounce); - -/******************************************************************************/ - uDom('#aboutVersion').html(chrome.runtime.getManifest().version); -uDom('#aboutAssetsUpdateButton').on('click', updateAssets); - -/******************************************************************************/ - -updateAssetsList(); /******************************************************************************/ |