LiveContent login bookmarklet with cookies. Remember LiveContent login in cookies, and speedup login by auto completing the field with JavaScript.
javascript:(function(){
if(window.location.href.contains("docs.sdl.com")) {
if(document.getElementById("username")) {
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
document.getElementById("username").value = readCookie("portalUsername");
document.getElementById("password").value = readCookie("portalPassword");
document.querySelectorAll(".login_button.xref").item(0).getElementsByTagName("img").item(0).click();
if(!document.getElementById("username").value || !document.getElementById("password").value) {
$(".splash").children(".fields").prepend("<p style='color:yellow'>the bookmarklet will remember your credentials next time</p>")
}
document.querySelectorAll(".login_button.xref").item(0).getElementsByTagName("img").item(0).onclick =
function(){
if(document.getElementById("username").value && document.getElementById("password").value) {
document.cookie = "portalUsername"+"="+document.getElementById("username").value+"; path=/";
document.cookie = "portalPassword"+"="+document.getElementById("password").value+"; path=/";
}
CVPortal.components.lcCommon.login();
};
document.getElementById("username").onkeydown =
function(event){
if(document.getElementById("username").value && document.getElementById("password").value) {
document.cookie = "portalUsername"+"="+document.getElementById("username").value+"; path=/";
document.cookie = "portalPassword"+"="+document.getElementById("password").value+"; path=/";
}
CVPortal.redirectEnter(event, 'CVPortal.components.lcCommon.login()');
};
document.getElementById("password").onkeydown =
function(event){
if(document.getElementById("username").value && document.getElementById("password").value) {
document.cookie = "portalUsername"+"="+document.getElementById("username").value+"; path=/";
document.cookie = "portalPassword"+"="+document.getElementById("password").value+"; path=/";
CVPortal.redirectEnter(event, 'CVPortal.components.lcCommon.login()');
}
};
}
} else {
window.location.href="http://docs.sdl.com/LiveContent/web/ui.xql?action=html&resource=login.html"
}
}());