Skip to content

Commit

Permalink
Release v1.3.0 and some changes (#21)
Browse files Browse the repository at this point in the history
Release v1.3.0 and some changes
  • Loading branch information
modos189 authored Dec 5, 2019
2 parents 290c00d + 007d9c4 commit d8114ab
Show file tree
Hide file tree
Showing 18 changed files with 117 additions and 63 deletions.
2 changes: 1 addition & 1 deletion _locales/ru/messages.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extName": {
"message": "IITC-Кнопка"
"message": "IITC-Button"
},
"extDescription": {
"message": "Запускайте Ingress Intel с IITC в один клик."
Expand Down
2 changes: 1 addition & 1 deletion _locales/uk/messages.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extName": {
"message": "IITC-Кнопка"
"message": "IITC-Button"
},
"extDescription": {
"message": "Запускай Ingress Intel с IITC в один клік."
Expand Down
6 changes: 2 additions & 4 deletions _locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
"extName": {
"message": "IITC-按键",
"description": "Main title on the Chrome Web Store"
"message": "IITC-Button"
},
"extDescription": {
"message": "启动IITC为进入英特尔轻松.",
"description": "Short description on the Chrome Web Store"
"message": "启动IITC为进入英特尔轻松."
},
"lang": {
"message": "zh_cn"
Expand Down
1 change: 0 additions & 1 deletion app/jsview/jsview.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
body {
background: #F0F0F0;
margin: 0;
font-family: system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue;
}

.row {
Expand Down
1 change: 1 addition & 0 deletions app/jsview/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<title>IITC-Button</title>
<link rel="shortcut icon" href="/assets/images/48/icon.png">
<link rel="stylesheet" type="text/css" href="highlightjs/default.css">
<link href="/assets/roboto/roboto-font.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="jsview.css">
</head>
<body>
Expand Down
4 changes: 3 additions & 1 deletion app/main/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ body {
background: #E8E9EC;
color: #222;
font-size: 18px;
font-family: system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue;
overflow: hidden;
}

Expand Down Expand Up @@ -83,7 +82,10 @@ body {
top: 0;
bottom: 0;
right: 0;
line-height: 26px;
padding: 2px 15px;
border: 1px solid #cdc7c2;
border-left: 0;
border-radius: 0 2px 2px 0;
font-size: 1.2em;
color: #00000000;
Expand Down
1 change: 1 addition & 0 deletions app/main/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<link href="/assets/roboto/roboto-font.css" rel="stylesheet">
<link rel="stylesheet" href="main.css" />
<title>IITC-Button</title>
<link rel="shortcut icon" href="/assets/images/48/icon.png">
Expand Down
34 changes: 33 additions & 1 deletion app/popup/components/section-main-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,44 @@ let ComponentMainMenu = Vue.component('section-main-menu', {
},
'openOptions': function () {
document.body.id = "options";
checkStatusLocalServer(this.localServerHost);
checkStatusLocalServer(app.$data.localServerHost);
},
'openCategory': function (category_name) {
document.body.id = "plugins";
this.$root.$data.category_name = category_name;
this.$root.$data.plugins = this.categories[category_name]['plugins'];
},
'sortCategories': function(obj) {

let arr = Object.keys(obj).map(function(key){
return obj[key];
});

for (let i=0;i<arr.length;i++) {
for (let j=i+1; j<arr.length; j++) {
if (this.__('name', arr[i]).toLowerCase() > this.__('name', arr[j]).toLowerCase()) {
let swap = arr[i];
arr[i] = arr[j];
arr[j] = swap;
}
}
}

// Move "External" to top
let el_external = null;
for (let i=0;i<arr.length;i++) {
if (arr[i].name.toLowerCase() === 'external') el_external = i;
}
if (el_external !== null) arr.unshift(...arr.splice(el_external,1));

// Move "Misc" to bottom
let el_misc = null;
for (let i=0;i<arr.length;i++) {
if (arr[i].name.toLowerCase() === 'misc') el_misc = i;
}
if (el_misc !== null) arr.push(arr.splice(el_misc,1)[0]);

return arr;
}
},
computed: {
Expand Down
1 change: 0 additions & 1 deletion app/popup/components/section-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ let ComponentPlugins = Vue.component('section-plugins', {
},
'savePlugin': function (id) {
chrome.storage.local.get([this.$root.channel+"_plugins_user"], (data) => {
console.log(data);
let plugin = data[this.$root.channel+"_plugins_user"][id];
saveJS(plugin['code'], plugin['filename']);
});
Expand Down
7 changes: 2 additions & 5 deletions app/popup/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ body {
margin: 0;
color: #222;
font-size: 12px;
font-family: var(--font-system);
}

.material-icons {
Expand Down Expand Up @@ -243,7 +242,7 @@ body#options .section.options, body#plugins .section.plugins {
* h2
*/
h2 {
font-size: 1.2em;
font-size: 1em;
margin: 0;
padding: 2px 12px 3px 10px;
}
Expand Down Expand Up @@ -315,7 +314,7 @@ h2:first-letter {
}
.update-check__label-wrapper {
display: flex;
justify-content: right;
justify-content: flex-end;
align-items: center;
width: 30%;
float: left;
Expand Down Expand Up @@ -445,8 +444,6 @@ h2:first-letter {


:root {
--font-system:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue;
--font-monospace:Menlo,Consolas,"DejaVu Sans Mono",monospace;
--color-white:#fff;
--color-blue:#0074d9;
--color-olive:#48a77c;
Expand Down
3 changes: 2 additions & 1 deletion app/popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">

<link href="/assets/iconfont/material-icons.css" rel="stylesheet">
<link href="/assets/roboto/roboto-font.css" rel="stylesheet">
<link rel="stylesheet" href="popup.css">
</head>
<body id="main-menu" class="body">
Expand All @@ -27,7 +28,7 @@
</div>
<div class="categories">

<template v-for="cat in categories">
<template v-for="cat in sortCategories(categories)">
<div v-if="cat.name" class="element item-wrapper list__item" v-bind:title="__('description', cat)" v-on:click="openCategory(cat.name)">
<span class="element__text">{{ __('name', cat) }}</span>
<span class="element__counter">{{ cat.count_plugins_active }}&nbsp;/&nbsp;{{ cat.count_plugins }}</span>
Expand Down
5 changes: 4 additions & 1 deletion app/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ chrome.storage.onChanged.addListener(function(changes, namespace) {
if (key === app.$data.channel+"_plugins") {
app.$data.categories = {};
app.$data.categories = changes[key].newValue;
console.log('up cats');

let category_name = app.$data.category_name;
if (category_name !== '') {
if (app.$data.categories[category_name]) {
Expand All @@ -109,5 +109,8 @@ chrome.storage.onChanged.addListener(function(changes, namespace) {
}
}
}
if (key === "local_server_host") {
app.$data.localServerHost = changes[key].newValue;
}
}
});
Binary file added assets/roboto/Roboto-Regular.woff2
Binary file not shown.
12 changes: 12 additions & 0 deletions assets/roboto/roboto-font.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'),
local('Roboto-Regular'),
url(Roboto-Regular.woff2) format('woff2');
}

body, input, select {
font-family: system-ui, "Roboto";
}
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "__MSG_extName__",
"description": "__MSG_extDescription__",
"version": "1.2.0",
"version": "1.3.0",
"minimum_chrome_version": "61",
"applications": {
"gecko": {
Expand Down
8 changes: 3 additions & 5 deletions scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ async function onRequestOpenIntel() {
if (lastIITCTab) {
const tabInfo = await getTabInfo(lastIITCTab);
if (isIngressUrl(tabInfo.url)) {
console.log('detected ingress.com/intel page on tab %d', lastIITCTab);
console.log('detected intel.ingress.com page on tab %d', lastIITCTab);
return setTabActive(lastIITCTab);
}
}

return chrome.tabs.create({
url: 'https://intel.ingress.com/intel',
url: 'https://intel.ingress.com/',
pinned: true
}, function(tab) {
lastIITCTab = tab.id;
Expand Down Expand Up @@ -70,8 +70,7 @@ async function onUpdatedListener(tabId, status) {
if (status.status === 'complete') {
const tabInfo = await getTabInfo(tabId);
if (isIngressUrl(tabInfo.url)) {
console.log('detected intel.ingress.com/intel page on tab %d', tabId);
console.log('requested iitc launch');
console.log('detected intel.ingress.com page on tab %d', tabId);
initialize();
lastIITCTab = tabId;
}
Expand Down Expand Up @@ -148,7 +147,6 @@ function injectUserScript(code) {
}, function (tabs) {

for (let tab of Object.values(tabs)) {
console.log(tab);
chrome.tabs.executeScript(tab.id, {
code: inject
}, () => {
Expand Down
22 changes: 15 additions & 7 deletions scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,28 @@ function parse_meta(code) {
return data;
}

const ajaxGet = (url, parseJSON) => new Promise(resolve => {
const ajaxGet = (url, variant) => new Promise(resolve => {
let method = (variant === "Last-Modified") ? "HEAD" : "GET";

let xhr = null;
xhr = new XMLHttpRequest();
if (!xhr) return null;
xhr.timeout = 5000;
xhr.open("GET", url+"?"+Date.now(),true);
xhr.open(method, url+"?"+Date.now(),true);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
let response = xhr.responseText;
if (parseJSON) {
response = JSON.parse(response);

if (variant === "Last-Modified") {
resolve(xhr.getResponseHeader('Last-Modified'))
} else {
let response = xhr.responseText;
if (variant === "parseJSON") {
response = JSON.parse(response);
}
resolve(response)
}
resolve(response)

} else {
resolve(null)
}
Expand All @@ -69,7 +77,7 @@ const checkStatusLocalServer = (host) => new Promise(resolve => {
app.$data.localServerStatus = 'err';

let xhr = new XMLHttpRequest();
xhr.open("GET", "http://"+host+"/meta.json", true);
xhr.open("GET", "http://"+host+"/meta.json?"+Date.now(), true);
xhr.timeout = 1000;
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
Expand Down
Loading

0 comments on commit d8114ab

Please sign in to comment.