Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dialog-promise

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dialog-promise - npm Package Compare versions

Comparing version 0.6.5 to 0.7.0

lib/dialog-promise.js.bak

128

lib/dialog-promise.js

@@ -28,3 +28,4 @@ "use strict";

reject:true,
rejectWhenCancelPrompt:null // same as reject
rejectWhenCancelPrompt:null, // same as reject
lengthMenuWithoutFilter:10
};

@@ -42,2 +43,3 @@

centerDialogEdge('top','offsetHeight','innerHeight');
dialogWindow.innerDiv.style.height = dialogWindow.offsetHeight-dialogWindow.innerDiv.offsetTop-2+'px';
}

@@ -78,2 +80,3 @@

return new Promise(function(resolve, reject){
var ubicateDialog;
var modalBackground = document.createElement('div');

@@ -83,2 +86,5 @@ modalBackground.className='dialog-promise-background';

dialogWindow.className='dialog-promise';
dialogWindow.innerDiv = document.createElement('div');
dialogWindow.innerDiv.className='dialog-promise-inner-div';
dialogWindow.appendChild(dialogWindow.innerDiv);
receiveOpts(dialogWindow, opts.mainAttrs);

@@ -88,2 +94,3 @@ var body = document.body;

window.removeEventListener('keydown', interceptKey);
window.removeEventListener('resize', ubicateDialog);
dialogWindow.style.display = 'none';

@@ -119,3 +126,3 @@ body.removeChild(modalBackground);

dialogWindow.style.display='block';
var ubicateDialog=function(){
ubicateDialog=function ubicateDialog(){
if(opts.underElement){

@@ -168,11 +175,28 @@ dialogWindow.setAttribute('docked','under');

window.addEventListener('keydown', interceptKey);
window.addEventListener('resize', ubicateDialog);
});
}
dialogPromise.addUpperDiv = function addUpperDiv(dialogWindow){
if(!dialogWindow.upperDiv){
var div=document.createElement('div');
div.className='dialog-promise-upper-div';
dialogWindow.upperDiv=div;
dialogWindow.insertBefore(div, dialogWindow.innerDiv);
div.floatDivs=document.createElement('div');
div.appendChild(div.floatDivs);
var divClear=document.createElement('div');
divClear.style.clear='both';
div.appendChild(divClear);
}
return dialogWindow.upperDiv.childNodes[0];
};
dialogPromise.addCloseButton={
false:function(){},
true:function(dialogWindow, done){
var div = dialogPromise.addUpperDiv(dialogWindow);
var closeButton=document.createElement('button');
closeButton.className='dialog-promise-close-button';
dialogWindow.appendChild(closeButton);
div.appendChild(closeButton);
closeButton.addEventListener('click', done);

@@ -184,3 +208,4 @@ }

var elementsList=opts.elementsList;
return dialogPromise(function(mainElement, done){
return dialogPromise(function(dialogWindow, done){
var mainElement = dialogWindow.innerDiv;
elementsList.forEach(function(elementDefinition){

@@ -328,22 +353,48 @@ if(typeof elementDefinition=='string'){

function miniMenuPromise(menu, opts){
return dialogPromise(function(mainElement,done){
return dialogPromise(function(dialogWindow,done){
var mainElement = dialogWindow.innerDiv;
var dpmmLines = 'dpmmLines'+miniMenuPromise.instanceCount++;
var style = document.createElement('style');
mainElement.appendChild(style);
var div=document.createElement('div');
var img=document.createElement('img');
img.src=DialogPromise.path.img+'filter-dialog.png';
img.style.height='16px';
div.appendChild(img);
div.style.width='100%';
div.style.textAlign='left';
div.onclick=function(){
span.style.position='';
span.focus();
};
var span=document.createElement('span');
// span.contenteditable=true;
span.contentEditable=true;
div.appendChild(span);
mainElement.appendChild(div);
if(opts && 'withMenuFilter' in opts?opts.withMenuFilter:menu.length>DialogPromise.defaultOpts.lengthMenuWithoutFilter){
var div=dialogPromise.addUpperDiv(dialogWindow);
var img=document.createElement('img');
img.src=DialogPromise.path.img+'filter-dialog.png';
img.style.height='16px';
div.appendChild(img);
div.onclick=function(){
span.style.position='';
span.focus();
};
var span=document.createElement('span');
// span.contenteditable=true;
span.contentEditable=true;
div.appendChild(span);
span.style.position='fixed'; span.style.top='-40px';
setTimeout(function(){
span.focus();
},50);
var cambiarTimeout;
var cambiar = function cambiar(){
if(span.textContent){
var caso=span.textContent.toLowerCase();
style.textContent="tr.dialog-menu-option{display: none} tr.dialog-menu-option["+dpmmLines+"*="+JSON.stringify(caso)+"]{ display: table-row}";
}else{
style.textContent='';
}
cambiarTimeout = null;
};
span.onkeydown=function(event){
var code=event.keyCode || event.which;
if(code==13 || code==9){
event.preventDefault();
return;
}
span.style.position='';
if(cambiarTimeout){
clearTimeout(cambiarTimeout);
}
cambiarTimeout=setTimeout(cambiar,200);
};
}
var table=document.createElement('table');

@@ -364,37 +415,2 @@ table.className='dialog-menu';

mainElement.classList.add('dialog-0');
span.style.position='fixed'; span.style.top='-40px';
setTimeout(function(){
span.focus();
},50);
var cambiarTimeout;
var cambiar = function cambiar(){
if(span.textContent){
var caso=span.textContent.toLowerCase();
style.textContent="tr.dialog-menu-option{display: none} tr.dialog-menu-option["+dpmmLines+"*="+JSON.stringify(caso)+"]{ display: inherit}";
}else{
style.textContent='';
}
cambiarTimeout = null;
};
mainElement.focus();
// mainElement.onkeydown=function(event){
// input.style.visibility='visible';
// input.focus();
// var text=event.key;
// if(text.length==1){
// input.value=text;
// }
// }
span.onkeydown=function(event){
var code=event.keyCode || event.which;
if(code==13 || code==9){
event.preventDefault();
return;
}
span.style.position='';
if(cambiarTimeout){
clearTimeout(cambiarTimeout);
}
cambiarTimeout=setTimeout(cambiar,200);
};
},opts);

@@ -401,0 +417,0 @@ }

{
"name": "dialog-promise",
"description": "Dialog that returns promises",
"version": "0.6.5",
"version": "0.7.0",
"author": "Codenautas <codenautas@googlegroups.com>",

@@ -16,3 +16,3 @@ "repository": "codenautas/dialog-promise",

"casperjs": "~1.1.4",
"es6-promise": "~4.1.0",
"es6-promise": "~4.1.1",
"phantomjs-prebuilt": "~2.1.14",

@@ -19,0 +19,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc