Remove html from Tags, Description and Title input
This commit is contained in:
parent
0f8a409cec
commit
4bd77f8dbf
@ -207,7 +207,14 @@ album = {
|
||||
buttons = [
|
||||
["Set Title", function() {
|
||||
|
||||
newTitle = ($(".message input.text").val()==="") ? "Untitled" : $(".message input.text").val();
|
||||
// Get input
|
||||
newTitle = $(".message input.text").val();
|
||||
|
||||
// Remove html from input
|
||||
newTitle = lychee.removeHTML(newTitle);
|
||||
|
||||
// Set to Untitled when empty
|
||||
newTitle = (newTitle==="") ? "Untitled" : newTitle;
|
||||
|
||||
if (visible.album()) {
|
||||
|
||||
@ -249,8 +256,12 @@ album = {
|
||||
buttons = [
|
||||
["Set Description", function() {
|
||||
|
||||
// Get input
|
||||
description = $(".message input.text").val();
|
||||
|
||||
// Remove html from input
|
||||
description = lychee.removeHTML(description);
|
||||
|
||||
if (visible.album()) {
|
||||
album.json.description = description;
|
||||
view.album.description();
|
||||
|
@ -336,6 +336,14 @@ var lychee = {
|
||||
|
||||
},
|
||||
|
||||
removeHTML: function(html) {
|
||||
|
||||
var tmp = document.createElement("DIV");
|
||||
tmp.innerHTML = html;
|
||||
return tmp.textContent || tmp.innerText;
|
||||
|
||||
},
|
||||
|
||||
error: function(errorThrown, params, data) {
|
||||
|
||||
console.log("Error Description: " + errorThrown);
|
||||
|
@ -207,8 +207,12 @@ photo = {
|
||||
buttons = [
|
||||
["Set Title", function() {
|
||||
|
||||
// Get input
|
||||
newTitle = $(".message input.text").val();
|
||||
|
||||
// Remove html from input
|
||||
newTitle = lychee.removeHTML(newTitle);
|
||||
|
||||
if (visible.photo()) {
|
||||
photo.json.title = (newTitle==="") ? "Untitled" : newTitle;
|
||||
view.photo.title();
|
||||
@ -337,8 +341,12 @@ photo = {
|
||||
buttons = [
|
||||
["Set Description", function() {
|
||||
|
||||
// Get input
|
||||
description = $(".message input.text").val();
|
||||
|
||||
// Remove html from input
|
||||
description = lychee.removeHTML(description);
|
||||
|
||||
if (visible.photo()) {
|
||||
photo.json.description = description;
|
||||
view.photo.description();
|
||||
@ -410,6 +418,9 @@ photo = {
|
||||
tags = tags.replace(/(\ ,\ )|(\ ,)|(,\ )|(,{1,}\ {0,})|(,$|^,)/g, ',');
|
||||
tags = tags.replace(/,$|^,|(\ ){0,}$/g, '');
|
||||
|
||||
// Remove html from input
|
||||
tags = lychee.removeHTML(tags);
|
||||
|
||||
if (visible.photo()) {
|
||||
photo.json.tags = tags;
|
||||
view.photo.tags();
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user