Skip to content

Commit

Permalink
fix cookie error and release a minor version
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyzy823 committed Apr 6, 2018
1 parent 253bba6 commit 6f4df64
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 25 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ Permission Details:

What's new:
-----------
+ version 0.1.4.1

bug fix: fix cookie error caused by different storage.local key name.
continously improve mobile ui
improve extension icon ui when recording


+ version 0.1.4

change to responsive ui in firefox android !

fix gps info mistake

adjust to correct japan timezone via moment-timezone

+ version 0.1.3
Expand Down Expand Up @@ -105,4 +110,5 @@ TODO
https://stackoverflow.com/questions/45911251/what-is-the-best-way-to-create-a-cross-browser-gmail-extension
https://www.smashingmagazine.com/2017/04/browser-extension-edge-chrome-firefox-opera-brave-vivaldi/
6. modify firefox android page to responsive page. (partially done)
6. modify firefox android page to responsive page. (partially done)
7. break the time limitation of timeshift and be able to download timeshift content
14 changes: 11 additions & 3 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,21 @@ chrome.storage.local.remove(["current_recording"],function(){

let modifier = [];

chrome.storage.local.get({"selected_area":"JP13"}, function (data) { //if not selected_area return default value:JP13
let area_id = data["selected_area"];
chrome.cookies.set({ url: "http://radiko.jp/", name: "default_area_id", value: area_id });
chrome.storage.local.get({"selected_areaid":"JP13"}, function (data) { //if not selected_areaid return default value:JP13
let area_id = data["selected_areaid"];
// //cookie may not be set here?
// chrome.cookies.set({ url: "http://radiko.jp/", name: "default_area_id", value: area_id },function(c){
// console.log("set cookie",c);
// });

chrome.runtime.onMessage.addListener(
function (msg,sender,respCallback) {
if (msg["update-area"]) {
area_id = msg["update-area"];
chrome.storage.local.set({ selected_areaid: area_id }, function () { });
chrome.cookies.set({ url: "http://radiko.jp/", name: "default_area_id", value: area_id },function(c){
console.log("set cookie",c);
});
} else if (msg["start-recording"]) {
let radioname = msg["start-recording"];

Expand All @@ -395,6 +402,7 @@ chrome.storage.local.get({"selected_area":"JP13"}, function (data) { //if not se

chrome.webRequest.onBeforeRequest.addListener(
function (req) {
chrome.cookies.set({ url: "http://radiko.jp/", name: "default_area_id", value: area_id });
return { cancel: true };
},
{ urls: ["*://*.radiko.jp/area*"] },
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"manifest_version": 2,
"name": "Rajiko",
"version": "0.1.4",
"version": "0.1.4.1",

"description": "__MSG_manifest_app_description__",

Expand Down Expand Up @@ -32,7 +32,7 @@

"content_scripts":[{
"matches": ["*://*.radiko.jp/"],
"js": ["ui/adjust-timezone.js"],
"js": ["ui/common_start.js"],
"run_at":"document_start"
}],
"web_accessible_resources": ["ui/moment-timezone.js"],
Expand Down
9 changes: 2 additions & 7 deletions popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ window.onload = function () {
window.close();
}
else {
chrome.storage.local.set({ selected_areaid: area.selectedOptions[0].id }, function () { });
chrome.runtime.sendMessage({ "update-area": area.selectedOptions[0].id });
chrome.tabs.query({ active: true, currentWindow: true }, function (arrayOfTabs) {
let tab = arrayOfTabs[0];
Expand All @@ -48,18 +47,14 @@ window.onload = function () {
}
window.close();
});

}
});

};

//load region and area
chrome.storage.local.get("selected_areaid", function (data) {
let area_id = "JP13"; //default for tokyo;
if (data["selected_areaid"]) {
area_id = data["selected_areaid"];
}
chrome.storage.local.get({"selected_areaid":"JP13"}, function (data) {
let area_id = data["selected_areaid"];
for (let i = 0; i < regions.length; i++) {
let tmp = document.createElement("option");
tmp.setAttribute("id", regions[i].id);
Expand Down
5 changes: 0 additions & 5 deletions ui/adjust-timezone.js

This file was deleted.

12 changes: 12 additions & 0 deletions ui/common_start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
document.addEventListener("DOMContentLoaded", function(event) {
/*
let beforeAllScript = document.createElement("script");
beforeAllScript.innerText = "debugger;";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(beforeAllScript, s);
*/

let momentscript = document.createElement("script");
momentscript.src = chrome.extension.getURL('ui/moment-timezone.js');
document.head.appendChild(momentscript);
});
4 changes: 3 additions & 1 deletion ui/mobile.css
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,6 @@ vertical-align: -17px;

.colorbox__play .btn-list li a.skip-btn {margin: 16px 6px 0 6px}

.colorbox__share {margin-top: 0px ;padding-bottom: 10px;padding-top: 10px}
.colorbox__share {margin-top: 0px ;padding-bottom: 10px;padding-top: 10px}

/*TODO: 1.timeshift page select from time or kyoku */
5 changes: 4 additions & 1 deletion ui/mobile_start.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ document.addEventListener("DOMContentLoaded", function(event) {
},600);

}

});

//TODO: consider use store.js from radiko with limitationobserver
window.localStorage['player-volume'] = 1; //because drag is impossbile .

});
8 changes: 5 additions & 3 deletions ui/moment-timezone.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
factory(root.moment); // Browser
}

moment.tz.add("Asia/Tokyo|JST JDT|-90 -a0|010101010|-QJH0 QL0 1lB0 13X0 1zB0 NX0 1zB0 NX0|38e6");
moment.tz.link("Asia/Tokyo|Japan");
moment.tz.setDefault("Asia/Tokyo");
}(this, function (moment) {
"use strict";

Expand Down Expand Up @@ -606,3 +603,8 @@

return moment;
}));
//! moment-timezone.js end

moment.tz.add("Asia/Tokyo|JST JDT|-90 -a0|010101010|-QJH0 QL0 1lB0 13X0 1zB0 NX0 1zB0 NX0|38e6");
moment.tz.link("Asia/Tokyo|Japan");
moment.tz.setDefault("Asia/Tokyo");

0 comments on commit 6f4df64

Please sign in to comment.