Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 15 additions & 22 deletions AutoPatchWork.safariextension/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,7 @@ init_barcss();
var version = '', Manifest;
IconData = {};

get_manifest(function (_manifest) {
Manifest = _manifest;
version = _manifest.version;
});
get_manifest();

function siteinfoFromCache() {
var data = Strg.get('siteinfo_wedata', true);
Expand Down Expand Up @@ -373,32 +370,28 @@ function Siteinfo(info) {
Strg.set('siteinfo_wedata', {siteinfo: siteinfo, timestamp: timestamp.toLocaleString()}, {day: 1});
applyCustom();
}
function get_manifest(callback) {
var url = './manifest.json';
function load_resource(url, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = function () {
callback(JSON.parse(xhr.responseText));
callback(xhr.responseText);
};
xhr.open('GET', url, true);
xhr.send(null);
}
function get_manifest() {
load_resource('./manifest.json', function (content) {
var _manifest = JSON.parse(content);
Manifest = _manifest;
version = _manifest.version;
});
}
function init_css() {
var url = 'css/AutoPatchWork.css';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = function() {
AutoPatchWork.save_css(xhr.responseText);
};
xhr.send(null);
load_resource('css/AutoPatchWork.css', AutoPatchWork.save_css);
}
function init_barcss() {
var url = 'css/AutoPatchWork.bar.css';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = function() {
AutoPatchWork.barcss = xhr.responseText;
};
xhr.send(null);
load_resource('css/AutoPatchWork.bar.css', function (content) {
AutoPatchWork.barcss = content;
});
}
function UpdateSiteinfo(callback, error_back, force) {
var sso = 'http://os0x.heteml.jp/ss-onet/json/wedataAutoPagerizeSITEINFO.json';
Expand Down