summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/editor-files/editor.js10
-rw-r--r--public/js/script.js9
2 files changed, 3 insertions, 16 deletions
diff --git a/public/editor-files/editor.js b/public/editor-files/editor.js
index 158b34f..06dc3e1 100644
--- a/public/editor-files/editor.js
+++ b/public/editor-files/editor.js
@@ -72,7 +72,7 @@ $(function() {
$('#publish-in-progress').removeClass('hidden');
$('#publish-fields').addClass('hidden');
- var category = csv_to_array($("#post-tags").tokenfield('getTokensList'));
+ var category = $("#note_category").tokenfield("getTokens").map(function(t){ return t.value});
$.post('/editor/publish', {
name: $("#post-name").val(),
@@ -149,14 +149,6 @@ function reset_page() {
return localforage.setItem('currentdraft', {});
}
-function csv_to_array(val) {
- if(val.length > 0) {
- return val.split(/[, ]+/);
- } else {
- return [];
- }
-}
-
/* ************************************************ */
/* autosave loop */
var autosaveTimeout = false;
diff --git a/public/js/script.js b/public/js/script.js
index f6f3a48..57990ee 100644
--- a/public/js/script.js
+++ b/public/js/script.js
@@ -14,15 +14,10 @@
return num;
}
- function csv_to_array(val) {
- if(val.length > 0) {
- return val.split(/[, ]+/);
- } else {
- return [];
- }
+ function tokenfieldToArray(sel) {
+ return $(sel).tokenfield("getTokens").map(function(t){ return t.value});
}
-
$(function(){
// Set the date from JS