Skip to content

Commit

Permalink
Rebuilt and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
stuyam committed Jul 23, 2021
1 parent e434534 commit e5b1321
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 17 deletions.
21 changes: 14 additions & 7 deletions dist/openpixel.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Open Pixel v1.2.0 | Published By Dockwa | Created By Stuart Yamartino | MIT License
// Open Pixel v1.3.0 | Published By Dockwa | Created By Stuart Yamartino | MIT License
;(function(window, document, pixelFunc, pixelFuncName, pixelEndpoint, versionNumber) {
"use strict";

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

Expand Down Expand Up @@ -97,7 +97,7 @@ var Browser = /*#__PURE__*/function () {
}, {
key: "isMobile",
value: function isMobile() {
return 'ontouchstart' in document;
return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
}
}, {
key: "userAgent",
Expand Down Expand Up @@ -209,8 +209,8 @@ var Url = /*#__PURE__*/function () {

_createClass(Url, null, [{
key: "getParameterByName",
// http://stackoverflow.com/a/901144/1231563
value: function getParameterByName(name, url) {
value: // http://stackoverflow.com/a/901144/1231563
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)", "i"),
Expand Down Expand Up @@ -411,9 +411,16 @@ pixelFunc.process = function (method, value, optional) {

for (var i = 0, l = pixelFunc.queue.length; i < l; i++) {
pixelFunc.process.apply(pixelFunc, pixelFunc.queue[i]);
}
} // https://github.com/GoogleChromeLabs/page-lifecycle/blob/master/src/Lifecycle.mjs
// Safari does not reliably fire the `pagehide` or `visibilitychange`

window.addEventListener('unload', function () {

var isSafari = (typeof safari === "undefined" ? "undefined" : _typeof(safari)) === 'object' && safari.pushNotification;
var isPageHideSupported = ('onpageshow' in self); // IE9-10 do not support the pagehide event, so we fall back to unload
// pagehide event is more reliable but less broad than unload event for mobile and modern browsers

var pageCloseEvent = isPageHideSupported && !isSafari ? 'pagehide' : 'unload';
window.addEventListener(pageCloseEvent, function () {
if (!Config.pageCloseOnce) {
Config.pageCloseOnce = true;
new Pixel('pageclose', Helper.now(), function () {
Expand Down
4 changes: 2 additions & 2 deletions dist/openpixel.min.js

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

2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ---------- Configurations for your custom build of open pixel ---------- //

// This is the header comment that will be included at the top of the "dist/openpixel.js" file
var HEADER_COMMENT = process.env.OPIX_HEADER_COMMENT || '// Open Pixel v1.2.0 | Published By Dockwa | Created By Stuart Yamartino | MIT License\n';
var HEADER_COMMENT = process.env.OPIX_HEADER_COMMENT || '// Open Pixel v1.3.0 | Published By Dockwa | Created By Stuart Yamartino | MIT License\n';

// This is where the compiled snippet and openpixel.js files will be dropped
var DESTINATION_FOLDER = process.env.OPIX_DESTINATION_FOLDER || './dist';
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": "openpixel",
"version": "1.2.0",
"version": "1.3.0",
"description": "Open Pixel is a JavaScript library for creating embeddable and intelligent tracking pixels",
"main": "openpixel.min.js",
"dependencies": {
Expand Down
7 changes: 2 additions & 5 deletions src/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,12 @@ for (var i = 0, l = pixelFunc.queue.length; i < l; i++) {

// https://github.com/GoogleChromeLabs/page-lifecycle/blob/master/src/Lifecycle.mjs
// Safari does not reliably fire the `pagehide` or `visibilitychange`
var isNotSafari = !(typeof safari === 'object' && safari.pushNotification);
var isSafari = typeof safari === 'object' && safari.pushNotification;
var isPageHideSupported = 'onpageshow' in self;

// IE9-10 do not support the pagehide event, so we fall back to unload
// pagehide event is more reliable but less broad than unload event for mobile and modern browsers
var pageCloseEvent =
isPageHideSupported && isNotSafari
? 'pagehide'
: 'unload';
var pageCloseEvent = isPageHideSupported && !isSafari ? 'pagehide' : 'unload';

window.addEventListener(pageCloseEvent, function() {
if (!Config.pageCloseOnce) {
Expand Down

0 comments on commit e5b1321

Please sign in to comment.