Skip to content

Commit

Permalink
Fix multiple open windows by TicketConsume (Zendesk) #188
Browse files Browse the repository at this point in the history
  • Loading branch information
joelthorner committed Sep 9, 2019
1 parent c914f35 commit 003c91e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
39 changes: 17 additions & 22 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,24 @@ chrome.runtime.onInstalled.addListener(function (details) {

// TicketConsume system
function openTicketConsumeTab() {
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',
// focused: true
}, function (window) {
// console.log(window);

// 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,
// index: 0,
// pinned: true,
// windowId: window.id
// });
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.runtime.onMessage.addListener(function (message, sender) {
if (message.name == 'openTicketConsumeTab') {
Expand All @@ -112,12 +113,6 @@ 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: '*://zdreports/rtm.cfm?TicketConsume=true'
// url: '*://joelthorner.github.io/temp/?TicketConsume=true'
}, function (tabs) {
tabs.forEach(tab => { chrome.tabs.remove(tab.id) });
});
});
});
}
Expand Down
1 change: 0 additions & 1 deletion js/inject/zendesk/ticket-consume.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ TicketConsume = {
chrome.runtime.sendMessage({ name: 'openTicketConsumeTab' });
} catch (error) {
console.log(error);

}
}
});
Expand Down
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.15', date: '10 Sep 2019',
lines: [
'FIXED Fix multiple open windows by TicketConsume (Zendesk) #188',
'IMPROVED Gulp automatic version replace (dev) #189'
]
}, {
version: 'v2.3.14', date: '04 Sep 2019',
lines: [
'FIXED Ticket consume get wrong data #184',
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.14",
"version": "2.3.15",
"manifest_version": 2,
"author": "joelthorner",
"description": "__MSG_appDesc__",
Expand Down

0 comments on commit 003c91e

Please sign in to comment.