deprecate plugin
This commit is contained in:
parent
faf8aa8c9d
commit
622018aadf
9 changed files with 1235 additions and 1400 deletions
10
README.md
10
README.md
|
@ -1,6 +1,14 @@
|
|||
Matomo Browser Injector
|
||||
========
|
||||
|
||||
## This browser extension isn't maintained anymore!
|
||||
|
||||
If you still wan't to inject Matomo scripts into websites without modifying them, take a look at the [Greasemonkey browser extension](https://www.greasespot.net/) that allows creating arbitrary userscripts.
|
||||
|
||||
This plugin is licensed under [the MIT License](https://github.com/Findus23/matomo-injector/blob/master/LICENSE), so feel free to fork it, if you want to continue maintaining it.
|
||||
|
||||
-----------
|
||||
|
||||
[![Chrome Web Store](https://img.shields.io/chrome-web-store/v/bglodhjbeeolbfpodfacccmnjledmggn.svg)](https://chrome.google.com/webstore/detail/matomo-browser-injector/bglodhjbeeolbfpodfacccmnjledmggn)
|
||||
[![Chrome Web Store](https://img.shields.io/badge/chrome%20web%20store-download%20now-brightgreen.svg)](https://chrome.google.com/webstore/detail/matomo-browser-injector/bglodhjbeeolbfpodfacccmnjledmggn)
|
||||
|
||||
|
@ -21,6 +29,6 @@ If you notice any bugs or have wishes for features open an issue on the github r
|
|||
https://github.com/Findus23/matomo-injector
|
||||
|
||||
|
||||
Licended under [the MIT License](https://github.com/Findus23/matomo-injector/blob/master/LICENSE) and based on the work of [hromadadan](https://github.com/guzart/customjs) and [xcv58](https://github.com/xcv58/Custom-JavaScript-for-Websites-2)
|
||||
Licensed under [the MIT License](https://github.com/Findus23/matomo-injector/blob/master/LICENSE) and based on the work of [hromadadan](https://github.com/guzart/customjs) and [xcv58](https://github.com/xcv58/Custom-JavaScript-for-Websites-2)
|
||||
|
||||
![screenshot](docs/screenshot_chrome_1.png)
|
||||
|
|
|
@ -62,5 +62,13 @@
|
|||
"enable_description": {
|
||||
"message": "aktivieren",
|
||||
"description": "label for checkbox"
|
||||
},
|
||||
"deprecation_warning": {
|
||||
"message": "Dieses Plugin wird nicht mehr gewartet!",
|
||||
"description": "shown in popup"
|
||||
},
|
||||
"export_info": {
|
||||
"message": "Sie können hier alle Ihre Daten exportieren:",
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,6 +107,14 @@
|
|||
"message": "inject globally",
|
||||
"description": "checkbox on settings page"
|
||||
},
|
||||
"deprecation_warning": {
|
||||
"message": "this plugin isn't maintained anymore!",
|
||||
"description": "shown in popup"
|
||||
},
|
||||
"export_info": {
|
||||
"message": "You can export all of your data here:",
|
||||
"description": ""
|
||||
},
|
||||
"enabled_badge_title": {
|
||||
"message": "This website is modified by Matomo Browser Injector.",
|
||||
"description": "title text of attention icon on every page where extention is enabled."
|
||||
|
|
|
@ -126,3 +126,17 @@ label span {
|
|||
.options {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#deprecation-block {
|
||||
margin-top: 1rem;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
#export-info {
|
||||
margin-top: 1rem;
|
||||
font-size: 15px;
|
||||
}
|
||||
#export-data {
|
||||
width: 100%;
|
||||
height: 150px;
|
||||
}
|
||||
|
|
124
js/popup.js
124
js/popup.js
|
@ -1,4 +1,7 @@
|
|||
document.addEventListener('DOMContentLoaded', function() {
|
||||
chrome.storage.sync.get(null, function(data) {
|
||||
document.getElementById("export-data").value = JSON.stringify(data, null, 4);
|
||||
});
|
||||
|
||||
var popup = {
|
||||
key: 'popup',
|
||||
|
@ -18,7 +21,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
expertMode: document.getElementById("expert-mode")
|
||||
},
|
||||
applyi18n: function() {
|
||||
var translatableIDs = ["error-message", "error-tip", "save", "reset", "goto-host", "enable-description", "host-label", "expert-mode-label", "draft-remove"];
|
||||
var translatableIDs = ["error-message", "error-tip", "save", "reset", "goto-host", "enable-description", "host-label", "expert-mode-label", "draft-remove", "deprecation-warning", "export-info"];
|
||||
translatableIDs.forEach(function(id) {
|
||||
var translateKey = id.replace(/-/g, "_");
|
||||
document.getElementById(id).innerText = chrome.i18n.getMessage(translateKey);
|
||||
|
@ -79,27 +82,27 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
|
||||
|
||||
chrome.storage.sync.get("hosts", function(items) {
|
||||
var hosts = items.hosts;
|
||||
if (!hosts) {
|
||||
hosts = [];
|
||||
}
|
||||
// Add current host to list
|
||||
if (hosts.indexOf(popup.url) === -1) {
|
||||
hosts.push(popup.url);
|
||||
}
|
||||
// Fill 'hosts select'
|
||||
hosts.forEach(function(host) {
|
||||
var option = document.createElement('option');
|
||||
option.innerText = host;
|
||||
if (host === popup.url) {
|
||||
option.setAttribute('selected', 'selected');
|
||||
}
|
||||
popup.el.hostSelect.appendChild(option);
|
||||
if (!response || typeof response.host !== 'string') {
|
||||
chrome.storage.sync.set({"hosts": hosts});
|
||||
}
|
||||
});
|
||||
var hosts = items.hosts;
|
||||
if (!hosts) {
|
||||
hosts = [];
|
||||
}
|
||||
// Add current host to list
|
||||
if (hosts.indexOf(popup.url) === -1) {
|
||||
hosts.push(popup.url);
|
||||
}
|
||||
// Fill 'hosts select'
|
||||
hosts.forEach(function(host) {
|
||||
var option = document.createElement('option');
|
||||
option.innerText = host;
|
||||
if (host === popup.url) {
|
||||
option.setAttribute('selected', 'selected');
|
||||
}
|
||||
popup.el.hostSelect.appendChild(option);
|
||||
if (!response || typeof response.host !== 'string') {
|
||||
chrome.storage.sync.set({"hosts": hosts});
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
/**
|
||||
* Set-up data (script, enable, include, extra)
|
||||
|
@ -135,16 +138,16 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
|
||||
matomo: {
|
||||
defaultTrackingCode: "var _paq = _paq || [];\n" +
|
||||
"/* tracker methods like \"setCustomDimension\" should be called before \"trackPageView\" */\n" +
|
||||
"_paq.push(['trackPageView']);\n" +
|
||||
"_paq.push(['enableLinkTracking']);\n" +
|
||||
"(function() {\n" +
|
||||
" var u=\"{{MATOMOURL}}\";\n" +
|
||||
" _paq.push(['setTrackerUrl', u+'piwik.php']);\n" +
|
||||
" _paq.push(['setSiteId', '{{SITEID}}']);\n" +
|
||||
" var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];\n" +
|
||||
" g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);\n" +
|
||||
"})();",
|
||||
"/* tracker methods like \"setCustomDimension\" should be called before \"trackPageView\" */\n" +
|
||||
"_paq.push(['trackPageView']);\n" +
|
||||
"_paq.push(['enableLinkTracking']);\n" +
|
||||
"(function() {\n" +
|
||||
" var u=\"{{MATOMOURL}}\";\n" +
|
||||
" _paq.push(['setTrackerUrl', u+'piwik.php']);\n" +
|
||||
" _paq.push(['setSiteId', '{{SITEID}}']);\n" +
|
||||
" var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];\n" +
|
||||
" g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);\n" +
|
||||
"})();",
|
||||
handleTrackingCode: function() {
|
||||
var matomoURL = encodeURI(popup.el.matomoURL.value);
|
||||
if (!matomoURL.endsWith("/")) {
|
||||
|
@ -247,13 +250,13 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
}
|
||||
|
||||
chrome.storage.sync.get("hosts", function(items) {
|
||||
var hosts = items.hosts;
|
||||
var index = hosts.indexOf(popup.url);
|
||||
if (index > -1) {
|
||||
hosts.splice(index, 1);
|
||||
}
|
||||
chrome.storage.sync.set({"hosts": hosts});
|
||||
var hosts = items.hosts;
|
||||
var index = hosts.indexOf(popup.url);
|
||||
if (index > -1) {
|
||||
hosts.splice(index, 1);
|
||||
}
|
||||
chrome.storage.sync.set({"hosts": hosts});
|
||||
}
|
||||
);
|
||||
|
||||
chrome.storage.sync.remove(popup.url);
|
||||
|
@ -317,33 +320,33 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
*/
|
||||
|
||||
var draftAutoSave = function() {
|
||||
var draft = popup.getCurrentData(),
|
||||
source = draft.source;
|
||||
var draft = popup.getCurrentData(),
|
||||
source = draft.source;
|
||||
|
||||
if (!popup.data) {
|
||||
popup.error();
|
||||
return false;
|
||||
}
|
||||
if (source || !popup.data.source) {
|
||||
if (!popup.data) {
|
||||
popup.error();
|
||||
return false;
|
||||
}
|
||||
if (source || !popup.data.source) {
|
||||
|
||||
var data = {};
|
||||
data[popup.url] = {draft: draft};
|
||||
chrome.storage.local.set(data);
|
||||
if (source !== popup.data.originalSource) {
|
||||
popup.el.draftRemoveLink.classList.remove('is-hidden');
|
||||
var data = {};
|
||||
data[popup.url] = {draft: draft};
|
||||
chrome.storage.local.set(data);
|
||||
if (source !== popup.data.originalSource) {
|
||||
popup.el.draftRemoveLink.classList.remove('is-hidden');
|
||||
|
||||
// Auto switch 'enable checkbox' on source edit
|
||||
if (!popup.el.enableCheck.classList.contains('not-auto-change')) {
|
||||
popup.el.enableCheck.checked = true;
|
||||
}
|
||||
} else {
|
||||
popup.el.draftRemoveLink.classList.add('is-hidden');
|
||||
// Auto switch 'enable checkbox' on source edit
|
||||
if (!popup.el.enableCheck.classList.contains('not-auto-change')) {
|
||||
popup.el.enableCheck.checked = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
popup.el.draftRemoveLink.classList.add('is-hidden');
|
||||
}
|
||||
|
||||
},
|
||||
draftAutoSaveInterval = setInterval(draftAutoSave, 1000);
|
||||
}
|
||||
|
||||
},
|
||||
draftAutoSaveInterval = setInterval(draftAutoSave, 1000);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -370,12 +373,11 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
try {
|
||||
popup.applyData(hostData, true);
|
||||
}
|
||||
// Hotfix for host without customjs
|
||||
// Hotfix for host without customjs
|
||||
catch (err) {
|
||||
popup.applyData(Object.assign(true, {}, popup.emptyDataPattern), true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Start making drafts
|
||||
draftAutoSaveInterval = setInterval(draftAutoSave, 1000);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"manifest_version": 2,
|
||||
"name": "__MSG_extension_name__",
|
||||
"short_name": "matomo-injector",
|
||||
"version": "3.3.2",
|
||||
"version": "4.0.0",
|
||||
"author": "Lukas Winkler, xcv58, hromadadan",
|
||||
"description": "__MSG_extension_description__",
|
||||
"icons": {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"eslint": "^4.19.1",
|
||||
"htmllint-cli": "0.0.6",
|
||||
"npm-run-all": "^4.1.3",
|
||||
"web-ext": "^2.3.0"
|
||||
"web-ext": "^3.2.1"
|
||||
},
|
||||
"scripts": {
|
||||
"copy": "bash copy.sh",
|
||||
|
|
|
@ -54,6 +54,10 @@
|
|||
<span id="error-tip"></span>
|
||||
</div><!-- .error -->
|
||||
|
||||
<div id="deprecation-block"><a class="pure-button" href="https://github.com/Findus23/matomo-injector#matomo-browser-injector" id="deprecation-warning"></a></div>
|
||||
<div id="export-info"></div>
|
||||
<textarea id="export-data" readonly></textarea>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript" src="libs/ace/ace.js" charset="utf-8"></script>
|
||||
<script src="js/popup.js"></script>
|
||||
|
|
Reference in a new issue