view src/main/webapp/resources/js/proxyMethods.js @ 77:997601ee0c6e

fix form submit issue above Chrome 56.x edition
author Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
date Wed, 03 May 2017 19:51:43 +0200
parents 90d5e86c157d
children
line wrap: on
line source


function setAction(action, formName){
	$("#loading").show();
  	
	var theForm = document.forms[formName];
    var input = document.createElement('input');
    input.type = 'hidden';
    input.name = 'action';
    input.value = action;
    theForm.appendChild(input);    
}


function setAction0(action, formName, varName, varValue){
	
	var theForm = document.forms[formName];
    var input = document.createElement('input');
    input.type = 'hidden';
    input.name = varName;
    input.value = varValue;
    theForm.appendChild(input);  
	
	setAction(action, formName);
}

function deleteBranch(action, formName, branchId){
	
	var theForm = document.forms[formName];
    var input = document.createElement('input');
    input.type = 'hidden';
    input.name = 'branchId';
    input.value = branchId;
    theForm.appendChild(input);  
	
	setAction(action, formName);
}

function deleteTopic(action, formName, topicId){
	
	var theForm = document.forms[formName];
    var input = document.createElement('input');
    input.type = 'hidden';
    input.name = 'topicId';
    input.value = topicId;
    theForm.appendChild(input);  
	
	setAction(action, formName);
}

function addContributor(action, formName, userId){
	var theForm = document.forms[formName];
    var input = document.createElement('input');
    input.type = 'hidden';
    input.name = 'userId';
    input.value = userId;
    theForm.appendChild(input);  
	setAction(action, formName);
}

function setCookie(value) {
    document.cookie = "saveTextToLGService=" + value + "; path=/LGServices/pages";
    return true;
}
function getCookie() {
    var cname = "saveTextToLGService=";
    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(cname) == 0) {
            return c.substring(cname.length, c.length);
        }
    }
    return null;
}