From 834f087add6c08fcd8713ba4b1090713c9cc4695 Mon Sep 17 00:00:00 2001 From: maxwroc Date: Sat, 20 Aug 2016 23:51:25 +0100 Subject: [PATCH 1/6] Release script #17 --- pack_extension.bat | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 pack_extension.bat diff --git a/pack_extension.bat b/pack_extension.bat new file mode 100644 index 0000000..4635f89 --- /dev/null +++ b/pack_extension.bat @@ -0,0 +1,26 @@ +@echo off +set extDir="" +set packer="%~dp0..\WinScripts\batch\ExtensionPacker.bat" + +rem if not "%1%"=="" set extDir=%1 +if not exist %extDir% ( + set extDir="UrlEditorPRO\UrlEditorPRO\app" +) + + +if not exist %extDir% ( + goto error +) + +if not exist %packer% ( + echo Packer not found %packer% + goto :eof +) + +%packer% %extDir% + +goto :eof + +:error +echo Extension directory not found: +echo %extDir%, %1 \ No newline at end of file From d8505807b1e9f23cf56318321a1eec9a6a3864bd Mon Sep 17 00:00:00 2001 From: maxwroc Date: Mon, 22 Aug 2016 23:58:11 +0100 Subject: [PATCH 2/6] basic migration changes --- UrlEditorPRO/app/manifest.json | 2 +- UrlEditorPRO/app/modules/tracking.ts | 44 ++++++++++++---------------- UrlEditorPRO/app/popup.ts | 2 +- 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/UrlEditorPRO/app/manifest.json b/UrlEditorPRO/app/manifest.json index 55892e5..0e04b12 100644 --- a/UrlEditorPRO/app/manifest.json +++ b/UrlEditorPRO/app/manifest.json @@ -28,5 +28,5 @@ } } }, - "content_security_policy": "script-src 'self' https://ssl.google-analytics.com; object-src 'self'" + "content_security_policy": "script-src 'self' https://www.google-analytics.com; object-src 'self'" } \ No newline at end of file diff --git a/UrlEditorPRO/app/modules/tracking.ts b/UrlEditorPRO/app/modules/tracking.ts index a7601b1..a87aec4 100644 --- a/UrlEditorPRO/app/modules/tracking.ts +++ b/UrlEditorPRO/app/modules/tracking.ts @@ -13,8 +13,9 @@ module UrlEditor.Tracking { Sort } - _gaq = window["_gaq"] = window["_gaq"] || []; - _gaq.push(['_setAccount', 'UA-81916828-1']); + export class Dimension { + public static Version = "dimension1"; + } var enableLogOncePerSession = true; var trackingEnabled = true; @@ -26,24 +27,22 @@ module UrlEditor.Tracking { if (!trackingEnabled) { return; } + + // TODO extract ga to support custom dimensions + (function (i, s, o, g, r) { + i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { + (i[r].q = i[r].q || []).push(arguments) + }, i[r].l = 1 * new Date(); var a = s.createElement(o), + m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) + })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); - _gaq.push(['_trackPageview']); - - var ga = document.createElement('script'); - ga.type = 'text/javascript'; - ga.async = true; - ga.src = 'https://ssl.google-analytics.com/ga.js'; - var s = document.getElementsByTagName('script')[0]; - s.parentNode.insertBefore(ga, s); + ga('create', 'UA-81916828-1', 'auto'); + // TODO disable validation + ga('send', 'pageview'); } - export function trackUserVariable(name: string, value: string) { - _gaq.push(['_setCustomVar', - 1, // This custom var is set to slot #1. Required parameter. - name, // The name of the custom variable. Required parameter. - value, // The value of the custom variable. Required parameter. - 1 // Sets the scope to visitor-level. Optional parameter. - ]); + export function setCustomDimension(name: string, value: string) { + //ga('set', name, value); } export function trackEvent(category: Category, action: string, label?: string, value?: string | number) { @@ -51,17 +50,12 @@ module UrlEditor.Tracking { return; } - var eventData: Array = ["_trackEvent", Category[category], action]; - - addOptionalEventParam(eventData, label); - addOptionalEventParam(eventData, value); - // check if we should log this event - if (!isLoggingEnabled(eventData)) { + if (!isLoggingEnabled(Array.prototype.slice.call(arguments))) { return; } - - _gaq.push(eventData); + + ga('send', 'event', Category[category], action, label, value); } function addOptionalEventParam(eventData: Array, param: string | number) { diff --git a/UrlEditorPRO/app/popup.ts b/UrlEditorPRO/app/popup.ts index 7c4981a..494b90a 100644 --- a/UrlEditorPRO/app/popup.ts +++ b/UrlEditorPRO/app/popup.ts @@ -20,7 +20,7 @@ module UrlEditor { var settings = new Settings(localStorage); // it is better to set variable before page view event (init) - Tracking.trackUserVariable("Version", version); + Tracking.setCustomDimension(Tracking.Dimension.Version, version); Tracking.init(settings.trackingEnabled); var versionElem = ge("version"); From 5da033ba44ccb6c7a672243f8dd17c76f61e7a10 Mon Sep 17 00:00:00 2001 From: Maks Date: Tue, 23 Aug 2016 16:26:22 +0100 Subject: [PATCH 3/6] Updated tracking with logging version dimension --- UrlEditorPRO/app/modules/tracking.ts | 32 ++++++++++++++++++---------- UrlEditorPRO/app/popup.ts | 1 + 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/UrlEditorPRO/app/modules/tracking.ts b/UrlEditorPRO/app/modules/tracking.ts index a87aec4..fb16d17 100644 --- a/UrlEditorPRO/app/modules/tracking.ts +++ b/UrlEditorPRO/app/modules/tracking.ts @@ -21,6 +21,19 @@ module UrlEditor.Tracking { var trackingEnabled = true; var logOncePerSession: IMap = {}; + // create global analytics object + (function internalInit(hostObject, propertyName) { + hostObject['GoogleAnalyticsObject'] = propertyName; + hostObject[propertyName] = hostObject[propertyName] || function () { + (hostObject[propertyName].q = hostObject[propertyName].q || []).push(arguments) + }; + hostObject[propertyName].l = 1 * new Date(); + })(window, 'ga'); + + // initial tracking variavles setup + ga('create', 'UA-81916828-1', 'auto'); + ga('set', 'checkProtocolTask', null); // Disables file protocol checking. + export function init(_trackingEnabled: boolean) { trackingEnabled = _trackingEnabled; @@ -28,21 +41,18 @@ module UrlEditor.Tracking { return; } - // TODO extract ga to support custom dimensions - (function (i, s, o, g, r) { - i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { - (i[r].q = i[r].q || []).push(arguments) - }, i[r].l = 1 * new Date(); var a = s.createElement(o), - m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) - })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); - - ga('create', 'UA-81916828-1', 'auto'); - // TODO disable validation + // load Analytics library + var a = document.createElement("script"); + a.async = true; + a.src = "https://www.google-analytics.com/analytics.js"; + var m = document.getElementsByTagName("script")[0]; + m.parentNode.insertBefore(a, m); + ga('send', 'pageview'); } export function setCustomDimension(name: string, value: string) { - //ga('set', name, value); + ga('set', name, value); } export function trackEvent(category: Category, action: string, label?: string, value?: string | number) { diff --git a/UrlEditorPRO/app/popup.ts b/UrlEditorPRO/app/popup.ts index 494b90a..1c195f2 100644 --- a/UrlEditorPRO/app/popup.ts +++ b/UrlEditorPRO/app/popup.ts @@ -21,6 +21,7 @@ module UrlEditor { // it is better to set variable before page view event (init) Tracking.setCustomDimension(Tracking.Dimension.Version, version); + Tracking.init(settings.trackingEnabled); var versionElem = ge("version"); From 927a0b317eadaa494791da295931979966756413 Mon Sep 17 00:00:00 2001 From: maxwroc Date: Tue, 23 Aug 2016 22:42:42 +0100 Subject: [PATCH 4/6] Fix auto-suggest click handling - to update url right away --- UrlEditorPRO/app/modules/autosuggest.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/UrlEditorPRO/app/modules/autosuggest.ts b/UrlEditorPRO/app/modules/autosuggest.ts index 05b5d9a..76a7308 100644 --- a/UrlEditorPRO/app/modules/autosuggest.ts +++ b/UrlEditorPRO/app/modules/autosuggest.ts @@ -281,8 +281,18 @@ switch (elem.className) { case "suggestion": this.inputElem.value = (elem).suggestionText; + + Tracking.trackEvent(Tracking.Category.AutoSuggest, "used"); + + // trigger event which will update param in the url (via view model) + var e = new Event("updated"); + e.initEvent("updated", true, true); + this.inputElem.dispatchEvent(e) break; case "delete": + + Tracking.trackEvent(Tracking.Category.AutoSuggest, "delete"); + this.deleteSuggestion(elem.parentElement); // prevent from triggering same event on suggestion evt.stopPropagation(); @@ -328,7 +338,8 @@ } Tracking.trackEvent(Tracking.Category.AutoSuggest, "used"); - + + // trigger event which will update param in the url (via view model) var e = new Event("updated"); e.initEvent("updated", true, true); this.inputElem.dispatchEvent(e) From 2021c1f8ff76204052247e3d68ca9a974e3fa91e Mon Sep 17 00:00:00 2001 From: maxwroc Date: Tue, 23 Aug 2016 22:55:30 +0100 Subject: [PATCH 5/6] Fix for setting focus on input when there is no params --- UrlEditorPRO/app/modules/helpers.ts | 4 ++-- UrlEditorPRO/app/modules/view_model.ts | 17 +++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/UrlEditorPRO/app/modules/helpers.ts b/UrlEditorPRO/app/modules/helpers.ts index 8ca3c56..7c7ae33 100644 --- a/UrlEditorPRO/app/modules/helpers.ts +++ b/UrlEditorPRO/app/modules/helpers.ts @@ -47,8 +47,8 @@ module UrlEditor { /** * Wrapper for document.getElementById */ - export function ge(elementId: string): HTMLElement { - return document.getElementById(elementId); + export function ge(elementId: string): T { + return document.getElementById(elementId); } /** diff --git a/UrlEditorPRO/app/modules/view_model.ts b/UrlEditorPRO/app/modules/view_model.ts index 6686fd8..c8675f9 100644 --- a/UrlEditorPRO/app/modules/view_model.ts +++ b/UrlEditorPRO/app/modules/view_model.ts @@ -32,7 +32,7 @@ constructor(private url: Uri, private doc: HTMLDocument, settings: Settings, private submit: (uri: Uri, openIn: OpenIn) => void) { - this.measureElem = ge("measure"); + this.measureElem = ge("measure"); // bind event handlers doc.body.addEventListener("click", evt => this.clickEventDispatcher(evt)); @@ -135,7 +135,7 @@ } if (activeElem.id != "full_url" || !isTextFieldActive) { - (ge("full_url")).value = this.url.url(); + ge("full_url").value = this.url.url(); } } @@ -165,7 +165,7 @@ private populateParams(setFocusOnLastOne: boolean = false) { var param: IParamContainerElement; - var params = ge("params"); + var params = ge("params"); // clean old set of params params.innerHTML = ""; @@ -217,8 +217,13 @@ this.doc.body.style.width = Math.min(longestBoth, maxClientWidth) + "px"; } - if (setFocusOnLastOne && param) { - param.nameElement.focus(); + if (setFocusOnLastOne) { + if (param) { + param.nameElement.focus(); + } + else { + ge("hostname").focus(); + } } } @@ -257,7 +262,7 @@ private setErrorMessage(err: string, elem?: HTMLElement) { // setting error message - ge("err").textContent = err ? "Error: " + err : ""; + ge("err").textContent = err ? "Error: " + err : ""; // if DOM element was passed we're setting or removing the error indicator color if (elem) { From 21cfd04c541cae2952a3b0738df24467cae3c226 Mon Sep 17 00:00:00 2001 From: maxwroc Date: Tue, 23 Aug 2016 22:56:22 +0100 Subject: [PATCH 6/6] bump manifest ver --- UrlEditorPRO/app/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UrlEditorPRO/app/manifest.json b/UrlEditorPRO/app/manifest.json index 0e04b12..ea02740 100644 --- a/UrlEditorPRO/app/manifest.json +++ b/UrlEditorPRO/app/manifest.json @@ -3,7 +3,7 @@ "name": "Url Editor PRO", "description": "Url parser which makes editing complex URLs as easy as possible. Features: params decoding, auto-suggest, keyboard navigation..", - "version": "0.8.3.0", + "version": "0.8.3.1", "permissions": [ "http://*/*",