You've already forked OpenShorte.old
Added new lines at the end of files, added edit functionality
This commit is contained in:
@@ -39,3 +39,56 @@ function insertNewURL() {
|
||||
data.append('url', url);
|
||||
xhr.send( data );
|
||||
}
|
||||
function editURL(node) {
|
||||
var url = node.childNodes[3].value;
|
||||
var url_id = node.childNodes[1].innerHTML
|
||||
var xhr = new XMLHttpRequest ( );
|
||||
xhr.open ( "POST", 'edit', true );
|
||||
xhr.onreadystatechange = function ( ) {
|
||||
if ( xhr.status == 200 ) {
|
||||
if ( xhr.readyState == XMLHttpRequest.DONE ) {
|
||||
var response = xhr.responseText;
|
||||
response = JSON.parse ( response );
|
||||
if ( response [ 'status' ] == 200 ) {
|
||||
document.getElementById ( "responsetext" ).innerHTML = response [ 'message' ];
|
||||
setTimeout( function( ) {
|
||||
document.getElementById ( 'responsetext' ).innerHTML = ""
|
||||
}, 1500 );
|
||||
}
|
||||
else {
|
||||
document.getElementById ( "responsetext" ).innerHTML = response [ 'error_message' ];
|
||||
setTimeout( function( ) {
|
||||
document.getElementById ( 'responsetext' ).innerHTML = ""
|
||||
}, 1500 );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
document.getElementById ( "responsetext" ).innerHTML = response [ 'error_message' ];
|
||||
setTimeout( function( ) {
|
||||
document.getElementById ( 'responsetext' ).innerHTML = ""
|
||||
}, 1500 );
|
||||
}
|
||||
}
|
||||
data = new FormData ( );
|
||||
data.append('url', url);
|
||||
data.append('url_id', url_id);
|
||||
xhr.send( data );
|
||||
}
|
||||
(function(){
|
||||
var URLs = document.getElementsByClassName("urlLink");
|
||||
for(i=0;i<URLs.length;i++) {
|
||||
URLs[i].onclick = function() {
|
||||
var oldText = this.value;
|
||||
this.parentNode.childNodes[5].style.display = "";
|
||||
this.parentNode.childNodes[5].childNodes[1].onclick = function() {
|
||||
editURL(this.parentNode.parentNode);
|
||||
this.parentNode.style.display = "none";
|
||||
}
|
||||
this.parentNode.childNodes[5].childNodes[3].onclick = function() {
|
||||
this.parentNode.parentNode.childNodes[3].value = oldText;
|
||||
this.parentNode.style.display = "none";
|
||||
};
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
@@ -246,4 +246,4 @@ function SHA512 ( str )
|
||||
binarray.push ( H [ i ].lowOrder );
|
||||
}
|
||||
return binb2hex ( binarray );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user