aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl/jot-header.tpl
diff options
context:
space:
mode:
Diffstat (limited to 'view/tpl/jot-header.tpl')
-rwxr-xr-xview/tpl/jot-header.tpl116
1 files changed, 39 insertions, 77 deletions
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl
index c84126d26..dd64c3454 100755
--- a/view/tpl/jot-header.tpl
+++ b/view/tpl/jot-header.tpl
@@ -5,12 +5,14 @@ var plaintext = '{{$editselect}}';
var pretext = '{{$pretext}}';
function initEditor(cb){
- if (editor==false){
+ if(editor == false){
$("#profile-jot-text-loading").show();
+ $("#profile-jot-reset").removeClass('d-none');
{{$geotag}}
if(plaintext == 'none') {
$("#profile-jot-text-loading").hide();
- $("#profile-jot-text").css({ 'height': 200 });
+ $(".jothidden").show();
+ $("#profile-jot-text").addClass('jot-expanded');
{{if $bbco_autocomplete}}
$("#profile-jot-text").bbco_autocomplete('{{$bbco_autocomplete}}'); // autocomplete bbcode
{{/if}}
@@ -21,82 +23,21 @@ function initEditor(cb){
$("#profile-jot-text").editor_autocomplete(baseurl+"/acl",[channelId]); // Also gives suggestions from current channel's connections
{{/if}}
editor = true;
- $("a#jot-perms-icon").colorbox({
- 'inline' : true,
- 'transition' : 'elastic'
- });
- $(".jothidden").show();
- $("#profile-jot-text").addClass('jot-expanded');
if (typeof cb!="undefined") cb();
if(pretext.length)
addeditortext(pretext);
return;
}
- tinyMCE.init({
- theme : "advanced",
- mode : "specific_textareas",
- editor_selector: {{$editselect}},
- auto_focus: "profile-jot-text",
- plugins : "bbcode,paste,autoresize, inlinepopups",
- theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
- theme_advanced_buttons2 : "",
- theme_advanced_buttons3 : "",
- theme_advanced_toolbar_location : "top",
- theme_advanced_toolbar_align : "center",
- theme_advanced_blockformats : "blockquote,code",
- gecko_spellcheck : true,
- paste_text_sticky : true,
- entity_encoding : "raw",
- add_unload_trigger : false,
- remove_linebreaks : false,
- force_p_newlines : false,
- force_br_newlines : true,
- forced_root_block : '',
- convert_urls: false,
- content_css: "{{$baseurl}}/view/custom_tinymce.css",
- theme_advanced_path : false,
- file_browser_callback : "fcFileBrowser",
- setup : function(ed) {
- cPopup = null;
- ed.onKeyDown.add(function(ed,e) {
- if(cPopup !== null)
- cPopup.onkey(e);
- });
-
- ed.onKeyUp.add(function(ed, e) {
- var txt = tinyMCE.activeEditor.getContent();
- match = txt.match(/@([^ \n]+)$/);
- if(match!==null) {
- if(cPopup === null) {
- cPopup = new ACPopup(this,baseurl+"/acl");
- }
- if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
- if(! cPopup.ready) cPopup = null;
- }
- else {
- if(cPopup !== null) { cPopup.close(); cPopup = null; }
- }
- });
-
- ed.onInit.add(function(ed) {
- ed.pasteAsPlainText = true;
- $("#profile-jot-text-loading").hide();
- $(".jothidden").show();
- if (typeof cb!="undefined") cb();
- });
-
- }
- });
-
- editor = true;
+ editor = true;
} else {
if (typeof cb!="undefined") cb();
}
}
function enableOnUser(){
- if (editor) return;
- $(this).val("");
+ if(editor)
+ return;
+
initEditor();
}
</script>
@@ -110,8 +51,7 @@ var activeCommentID = 0;
var activeCommentText = '';
$(document).ready(function() {
-
- /* enable tinymce on focus and click */
+
$("#profile-jot-text").focus(enableOnUser);
$("#profile-jot-text").click(enableOnUser);
@@ -157,6 +97,7 @@ var activeCommentText = '';
$('#invisible-comment-upload').fileupload({
url: 'wall_attach/{{$nickname}}',
dataType: 'json',
+ dropZone: $(),
maxChunkSize: 4 * 1024 * 1024,
add: function(e,data) {
@@ -357,6 +298,24 @@ var activeCommentText = '';
}
}
+ function itemCancel() {
+ $("#jot-title").val('');
+ $("#profile-jot-text").val('');
+ $("#jot-category").tagsinput('removeAll');
+
+ postSaveChanges('clean');
+
+ {{if $reset}}
+ $(".jothidden").hide();
+ $("#profile-jot-text").removeClass('jot-expanded');
+ $("#profile-jot-reset").addClass('d-none');
+ $("#jot-preview-content").html('').hide();
+ editor = false;
+ {{else}}
+ window.history.back();
+ {{/if}}
+ }
+
function itemFiler(id) {
if($('#item-filer-dialog').length)
$('#item-filer-dialog').remove();
@@ -524,10 +483,13 @@ var activeCommentText = '';
}
- // file drag hover
- function DragDropUploadFileHover(e) {
- e.target.className = (e.type == "dragover" ? "hover" : "");
- }
+ // file drag hover
+ function DragDropUploadFileHover(e) {
+ if(e.type == 'dragover')
+ $(e.target).addClass('hover');
+ else
+ $(e.target).removeClass('hover');
+ }
// file selection
function DragDropUploadFileSelectHandler(e) {
@@ -536,7 +498,7 @@ var activeCommentText = '';
DragDropUploadFileHover(e);
// open editor if it isn't yet initialised
if (!editor) {
- initEditor();
+ enableOnUser();
}
linkdrop(e);
@@ -565,7 +527,7 @@ $( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-del
<script>
var postSaveTimer = null;
- function postSaveChanges(action, type) {
+ function postSaveChanges(action) {
if({{$auto_save_draft}}) {
var doctype = $('#jot-webpage').val();
@@ -575,7 +537,7 @@ $( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-del
localStorage.setItem("post_title" + postid, $("#jot-title").val());
localStorage.setItem("post_body" + postid, $("#profile-jot-text").val());
if($("#jot-category").length)
- localStorage.setItem("post_category + postid", $("#jot-category").val());
+ localStorage.setItem("post_category" + postid, $("#jot-category").val());
}
if(action == 'start') {
@@ -628,7 +590,7 @@ $( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-del
openEditor = true;
}
if(openEditor) {
- initEditor();
+ enableOnUser();
}
} else {
postSaveChanges('clean');