Socket
Socket
Sign inDemoInstall

knockout-popup-template

Package Overview
Dependencies
2
Maintainers
6
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.8.1 to 1.9.0

.eslintrc.js

84

knockout.popupTemplate.js

@@ -110,3 +110,5 @@ /*

if (newValue) {
if (this.disabled()) return;
if (this.disabled()) {
return;
}
// if the popup is being opened

@@ -145,3 +147,2 @@ this.options.beforeOpen();

var bestCandidate = null;
var constrainedOffsets = [];
for (var i = 0; i < positioning.length; i += 1) {

@@ -171,3 +172,2 @@ var position = ko.toJS(positioning[i]);

Popup.prototype.createElementContainer = function () {
var that = this;
var $popupHolder;

@@ -360,2 +360,54 @@ var classes = ['popupTemplate', 'popup-container'];

function eachIFrameContents(callback) {
$('iframe').each(function (index, iframe) {
var src = iframe.src;
var origin = window.location.origin || location.protocol + '//' + location.host;
if (!src || src.indexOf(origin) === 0) {
$(iframe).contents().each(callback);
}
});
}
Popup.closeOnEsc = {
elements: [],
handlerRegistered: false,
handler: function () {
if (Popup.closeOnEsc.elements.length > 0) {
var lastIndex = Popup.closeOnEsc.elements.length - 1;
var lastItem = Popup.closeOnEsc.elements[lastIndex];
if (event.which === 27 && lastItem.openState()) {
lastItem.openState(false);
}
}
},
setupHandler: function () {
if (!Popup.closeOnEsc.handlerRegistered) {
document.addEventListener('keydown', Popup.closeOnEsc.handler, false);
eachIFrameContents(function (index, doc) {
doc.addEventListener('keydown', Popup.closeOnEsc.handler, false);
});
Popup.closeOnEsc.handlerRegistered = true;
}
},
tearDownHandler: function () {
if (Popup.closeOnEsc.handlerRegistered && Popup.closeOnEsc.elements.length === 0) {
document.removeEventListener('keydown', Popup.closeOnEsc.handler, false);
eachIFrameContents(function (index, doc) {
doc.removeEventListener('keydown', Popup.closeOnEsc.handler, false);
});
Popup.closeOnEsc.handlerRegistered = false;
}
},
registerElement: function (element) {
Popup.closeOnEsc.elements.push(element);
Popup.closeOnEsc.setupHandler();
},
unregisterElement: function (element) {
Popup.closeOnEsc.elements = Popup.closeOnEsc.elements.filter(function (el) {
return el !== element;
});
Popup.closeOnEsc.tearDownHandler();
}
};
var HORIZONTAL_POSITIONS = ['outside-left', 'inside-left', 'middle', 'inside-right', 'outside-right'];

@@ -566,18 +618,2 @@ var VERTICAL_POSITIONS = ['outside-top', 'inside-top', 'middle', 'inside-bottom', 'outside-bottom'];

function closePopupHandlerOnEsc(event) {
if (event.which === 27 && config.openState()) {
config.openState(false);
}
}
function eachIFrameContents(callback) {
$('iframe').each(function (index, iframe) {
var src = iframe.src;
var origin = window.location.origin || location.protocol + '//' + location.host;
if (!src || src.indexOf(origin) === 0) {
$(iframe).contents().each(callback);
}
});
}
function addCloseHandler() {

@@ -589,5 +625,2 @@ eachIFrameContents(function (index, doc) {

}
if (config.closeOnEsc) {
doc.addEventListener('keydown', closePopupHandlerOnEsc, false);
}
});

@@ -599,3 +632,3 @@ if (config.outsideHandler) {

if (config.closeOnEsc) {
document.addEventListener('keydown', closePopupHandlerOnEsc, false);
Popup.closeOnEsc.registerElement(config);
}

@@ -612,5 +645,2 @@ $(window).on('resize', popupReposition);

}
if (config.closeOnEsc) {
doc.removeEventListener('keydown', closePopupHandlerOnEsc, false);
}
});

@@ -622,3 +652,3 @@ if (config.outsideHandler) {

if (config.closeOnEsc) {
document.removeEventListener('keydown', closePopupHandlerOnEsc, false);
Popup.closeOnEsc.unregisterElement(config);
}

@@ -625,0 +655,0 @@ $(window).off('resize', popupReposition);

@@ -5,3 +5,3 @@ {

"main": "knockout.popupTemplate.js",
"version": "1.8.1",
"version": "1.9.0",
"contributors": [

@@ -30,2 +30,3 @@ {

"scripts": {
"lint": "eslint .",
"test": "mocha-phantomjs test/index.html -v 600x800"

@@ -42,7 +43,9 @@ },

"devDependencies": {
"eslint": "3.7.1",
"eslint-config-onelint": "1.1.0",
"jquery": "=1.11.0",
"knockout": "3.0.0",
"mocha": "2.0.1",
"mocha-phantomjs": "3.5.1",
"phantomjs": "1.9.12",
"mocha-phantomjs": "4.1.0",
"phantomjs": "1.9.7-15",
"sinon": "1.11.1",

@@ -49,0 +52,0 @@ "unexpected": "9.2.0",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc