defencedog
03-03-2012, 03:37 PM
i want to have the capability similar as that of vbulletin so that if user is writing reply using 'quick reply' & want to move to full editor page the contents be preserved.
@phpbb3 (I am successful needs optimisation)
1] the textarea id is similar both in quick & full reply editors
2] When replying a special string is there in url
my code:
var field = document.getElementById("text_editor_textarea");
if (sessionStorage.getItem("autosave") && document.URL.indexOf("mode=reply") > 0) {
field.value = sessionStorage.getItem("autosave");
}
if (field) {
setInterval(function() {
sessionStorage.setItem("autosave", field.value);
}, 1e3);
}
Now everone knows this time interval function is heavy for browsers...so I want to start ts only when field.value.length > 0 but I am unable to do so. Any suggestions. Simply this willnt work
if (field && field.value.length > 0) {
@phpbb3 (I am successful needs optimisation)
1] the textarea id is similar both in quick & full reply editors
2] When replying a special string is there in url
my code:
var field = document.getElementById("text_editor_textarea");
if (sessionStorage.getItem("autosave") && document.URL.indexOf("mode=reply") > 0) {
field.value = sessionStorage.getItem("autosave");
}
if (field) {
setInterval(function() {
sessionStorage.setItem("autosave", field.value);
}, 1e3);
}
Now everone knows this time interval function is heavy for browsers...so I want to start ts only when field.value.length > 0 but I am unable to do so. Any suggestions. Simply this willnt work
if (field && field.value.length > 0) {