Skip to content

Commit

Permalink
Merge pull request #196 from joelthorner/2.x
Browse files Browse the repository at this point in the history
2.3.16
  • Loading branch information
joelthorner authored Sep 16, 2019
2 parents de27d34 + 1e2999a commit 84cd708
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 35 deletions.
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const VERSION = "2.3.15";
const VERSION = "2.3.16";

var gulp = require('gulp');
var replace = require('gulp-replace');
Expand Down
61 changes: 30 additions & 31 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,45 +65,38 @@ chrome.runtime.onInstalled.addListener(function (details) {
url: chrome.extension.getURL('/src/install/index.html')
});
} else if (details.reason == 'update') {
chrome.notifications.create('newVersion-' + manifestData.version, opt, function () {
chrome.storage.sync.set({
newVersionNotify: manifestData.version
});
});
var newVersionArr = manifestData.version.split('.'),
newMainVersion = newVersionArr[0] + '.' + newVersionArr[1];

chrome.storage.sync.get({ newVersionNotify: newMainVersion }, function (result) {
var oldVersionArr = result.newVersionNotify.split('.'),
oldMainVersion = oldVersionArr[0] + '.' + oldVersionArr[1];

console.log(parseFloat(newMainVersion), parseFloat(oldMainVersion));
if (parseFloat(newMainVersion) > parseFloat(oldMainVersion)) {
chrome.notifications.create('newVersion-' + manifestData.version, opt);

chrome.notifications.onButtonClicked.addListener(function (notificationId, buttonIndex) {
if (notificationId == 'newVersion-' + manifestData.version && buttonIndex == 1) {
chrome.tabs.create({
url: chrome.extension.getURL('/src/options/index.html') + '#changelog'
chrome.notifications.onButtonClicked.addListener(function (notificationId, buttonIndex) {
if (notificationId == 'newVersion-' + manifestData.version && buttonIndex == 1) {
chrome.tabs.create({ url: chrome.extension.getURL('/src/options/index.html') + '#changelog' });
}
});

chrome.browserAction.setBadgeText({ text: '!' });
chrome.browserAction.setBadgeBackgroundColor({ color: '#ff0068' });
}
chrome.storage.sync.set({ newVersionNotify: newMainVersion });
});

chrome.browserAction.setBadgeText({ text: '!' });
chrome.browserAction.setBadgeBackgroundColor({ color: '#ff0068' });
}
});

// TicketConsume system
function openTicketConsumeTab() {
chrome.tabs.query({
url: '*://zdreports/rtm.cfm?TicketConsume=true'
// url: '*://joelthorner.github.io/temp/?TicketConsume=true'
}, function (tabs) {
if (!tabs.length) {
chrome.tabs.create({
url: 'http://192.168.110.109:12853/zdreports/rtm.cfm?TicketConsume=true',
// url: 'https://joelthorner.github.io/temp/?TicketConsume=true',
active: false,
pinned: true,
});
} else {
tabs.forEach(tab => {
chrome.tabs.reload(tab.id);
});
}
chrome.windows.create({
url: 'http://192.168.110.109:12853/zdreports/rtm.cfm?TicketConsume=true',
// url: 'https://joelthorner.github.io/temp/?TicketConsume=true',
state: 'minimized'
});

}
chrome.runtime.onMessage.addListener(function (message, sender) {
if (message.name == 'openTicketConsumeTab') {
Expand All @@ -113,12 +106,18 @@ chrome.runtime.onMessage.addListener(function (message, sender) {
chrome.tabs.query({ url: '*://tlgcommercehelp.zendesk.com/*' }, function (tabs) {
tabs.forEach(tab => {
chrome.tabs.sendMessage(tab.id, { data: message.data });
chrome.tabs.query({
url: 'http://192.168.110.109:12853/zdreports/rtm.cfm?TicketConsume=true'
// url: '*://joelthorner.github.io/temp/?TicketConsume=true'
}, function (tabs) {
tabs.forEach(tab => { chrome.tabs.remove(tab.id) });
});
});
});
}
});
chrome.tabs.onActivated.addListener(function (activeInfo) {
chrome.tabs.get(activeInfo.tabId, function (tab){
chrome.tabs.get(activeInfo.tabId, function (tab) {
if (tab.url.includes("tlgcommercehelp.zendesk.com")) {
chrome.storage.sync.get({ optZenTicketConsume: false }, function (result) {
if (result.optZenTicketConsume) {
Expand All @@ -127,4 +126,4 @@ chrome.tabs.onActivated.addListener(function (activeInfo) {
});
}
});
});
});
6 changes: 6 additions & 0 deletions js/options/changelog.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
const CHANGELOG = [
{
version: 'v2.3.16', date: '13 Sep 2019',
lines: [
'CHANGED Limitation of new version notify, only major and medium version change #194',
'FIXED Fix url close match tab ticketConsume #193'
]
}, {
version: 'v2.3.15', date: '10 Sep 2019',
lines: [
'FIXED Fix multiple open windows by TicketConsume (Zendesk) #188',
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "__MSG_appName__",
"version": "2.3.15",
"version": "2.3.16",
"manifest_version": 2,
"author": "joelthorner",
"description": "__MSG_appDesc__",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tlmanager",
"version": "2.3.15",
"version": "2.3.16",
"description": "Development tool",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down

0 comments on commit 84cd708

Please sign in to comment.