forked from GithubBackups/tinyib
Remember password used when posting
This commit is contained in:
parent
884802259b
commit
16a87d6dc2
@ -304,7 +304,7 @@ EOF;
|
|||||||
Password
|
Password
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="password" name="password" size="8" accesskey="p"> (for post and file deletion)
|
<input type="password" name="password" id="newpostpassword" size="8" accesskey="p"> (for post and file deletion)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -332,7 +332,7 @@ EOF;
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
Delete Post <input type="password" name="password" size="8" placeholder="Password"> <input name="deletepost" value="Delete" type="submit">
|
Delete Post <input type="password" name="password" id="deletepostpassword" size="8" placeholder="Password"> <input name="deletepost" value="Delete" type="submit">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
44
js/tinyib.js
44
js/tinyib.js
@ -1,6 +1,21 @@
|
|||||||
function quotePost(postID){
|
function getCookie(name) {
|
||||||
|
var value = "; " + document.cookie;
|
||||||
|
var parts = value.split("; " + name + "=");
|
||||||
|
if (parts.length == 2) return parts.pop().split(";").shift();
|
||||||
|
}
|
||||||
|
|
||||||
|
function storePassword() {
|
||||||
|
var newpostpassword = document.getElementById("newpostpassword");
|
||||||
|
if (newpostpassword) {
|
||||||
|
var expiration_date = new Date();
|
||||||
|
expiration_date.setFullYear(expiration_date.getFullYear() + 7);
|
||||||
|
document.cookie = "tinyib_password=" + encodeURIComponent(newpostpassword.value) + "; path=/; expires=" + expiration_date.toGMTString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function quotePost(postID) {
|
||||||
var message_element = document.getElementById("message");
|
var message_element = document.getElementById("message");
|
||||||
if (message_element){
|
if (message_element) {
|
||||||
message_element.focus();
|
message_element.focus();
|
||||||
message_element.value += '>>' + postID + "\n";
|
message_element.value += '>>' + postID + "\n";
|
||||||
}
|
}
|
||||||
@ -8,11 +23,28 @@ function quotePost(postID){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
if(window.location.hash){
|
var newpostpassword = document.getElementById("newpostpassword");
|
||||||
if(window.location.hash.match(/^#q[0-9]+$/i) !== null){
|
if (newpostpassword) {
|
||||||
|
newpostpassword.addEventListener("change", storePassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
var password = getCookie("tinyib_password");
|
||||||
|
if (password && password != "") {
|
||||||
|
if (newpostpassword) {
|
||||||
|
newpostpassword.value = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
var deletepostpassword = document.getElementById("deletepostpassword");
|
||||||
|
if (deletepostpassword) {
|
||||||
|
deletepostpassword.value = password;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window.location.hash) {
|
||||||
|
if (window.location.hash.match(/^#q[0-9]+$/i) !== null) {
|
||||||
var quotePostID = window.location.hash.match(/^#q[0-9]+$/i)[0].substr(2);
|
var quotePostID = window.location.hash.match(/^#q[0-9]+$/i)[0].substr(2);
|
||||||
if (quotePostID != ''){
|
if (quotePostID != '') {
|
||||||
quotePost(quotePostID);
|
quotePost(quotePostID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user