JSFiddle - React, Tailwind, and code Playground

AES Page Encryption (deletion from wrong key on 2nd link issue)

by dledle2

HTML

<script src="https://rawgit.com/victornpb/f639f37373be0f6e82e1/raw/5d8f7ee8b32ae04de087d2377d8086e3389ee411/AES.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<a href="http://www.movable-type.co.uk/scripts/aes.html">http://www.movable-type.co.uk/scripts/aes.html</a>
<br>
<a href="#" aes-href="cAB4fffxn10MHZCEl+Ff4SnEDfwDaEIIh0wYplSF6sK7AzsIOcch7mla18O+a3b2FkhZ" data-enc="AES-256" target="_new">jsfiddle</a>
    
<br>
<a href="#" aes-href="cAB4fffxn10MHZCEl+Ff4SnEDfwDaEIIh0wYplSF6sK7AzsIOcch7mla18O+a3b2FkhZ" data-enc="AES-256" target="_blank">jsfiddle</a>

<div id="decryptionModal" class="overlay">
    <div class="col-sm-6 col-center">
        <form>
            <div class="panel panel-default">
                <div class="panel-heading">Area restrita
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span>

                    </button>
                </div>
                <div class="panel-body">
                    <div class="form-group">
                        
                        <p class="help-block text-center">O link que você está tentando abrir, faz parte de uma área restrita. Uma senha é nescessária para acessá-o.</p>
                        <label label-default="" for="inputPassword1" class="col-lg-2 control-label ">Senha</label>
                        <div class="col-lg-10">
                            <input type="password" class="form-control" id="inputPassword1" placeholder="senha" autofocus>
                        </div>
                    </div>
                    <div class="form-group hidden">
                        <div class="col-lg-offset-2 col-lg-10">
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox">Remember me</label>
                            </div>
                        </div>
  ...

CSS

a[data-enc="AES-256"]:after {
    /* locked */
    content:'\1f512';
    font-size: 1em;
    opacity: 1;
}
a[data-enc="none"]:after {
    /* unlocked */
    content:'\1f513';
    font-size: 0.85em;
    opacity: 0.5;
}
/* CSS used here will be applied after bootstrap.css */
 .overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.25);
    float: none;
}
.col-center {
    float: none;
    margin: 0 auto;
}
.overlay > div {
    margin-top: 1em;
}

JavaScript

if (location.protocol != 'http:') {
  
try{location.href = 'http:' + window.location.href.substring(window.location.protocol.length);    }catch(e){}}




/* myStrURL= */
/* try{window.open(myStrURL , '' , '');    }catch(e){} */
window.boolWindowOpenedSuccessfullyAlready = false;

function inIframe () {
    try {
        /* below command will cause a permissions error when using iframes */ 
        /* and will break into the catch part for error handling           */
        return window.self !== window.top;
    } catch (e) {
        return true;
    }
}

function isURLjsfiddleshowlight () {
   if (       document.location.href.toLowerCase().contains('/show/light/')       )
      {return true;}
   else
      {return false;}
   /* below end bracket: end of function: isURLjsfiddleshowlight*/
}


try{
if (inIframe() === true){
   if (window.open(window.location.href)){window.boolWindowOpenedSuccessfullyAlready=true;}  
}
/* if (isURLjsfiddleshowlight() != true){window.open(window.location.href);    }  */
}catch(e){}
/* alert(window.boolWindowOpenedSuccessfullyAlready);    */




function myFuncinIframeAndAlsoWindowOpenSameFunction() {

if (typeof window.boolWindowOpenedSuccessfullyAlready == 'undefined')
{ window.boolWindowOpenedSuccessfullyAlready=false; }

console.log(window.boolWindowOpenedSuccessfullyAlready);
if (window.boolWindowOpenedSuccessfullyAlready ===false) {
   try {
      if(window.self !== window.top){
         if (window.open(window.location.href)){window.boolWindowOpenedSuccessfullyAlready=true;}
         /*   */ 
      }
   }catch(e){}
}
console.log(window.boolWindowOpenedSuccessfullyAlready);
   /* below end bracket: end of function: myFuncinIframeAndAlsoWindowOpenSameFunction */
}


myFuncinIframeAndAlsoWindowOpenSameFunction();

/* myStrURL=window.location.href;  */
/* try{window.open(myStrURL , '' , '');    }catch(e){}  */













// Write JavaScript here window.onload = initSecurity;
window.onload = initSecurity;

function initSecurity()...