X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=view%2Ftheme%2Ftestbubble%2Fjot-header.tpl;h=0d11da271758c35e6df778d90fbae59f9b17ea37;hb=0cc661dd9c4c6a3d282ca07230b59411ecf97ff0;hp=0093bf82a85b48bfa7323b6a5704864d47f6a09d;hpb=60e0f79b9f9e94b19cc412eac41e5d8f8fec2383;p=friendica.git diff --git a/view/theme/testbubble/jot-header.tpl b/view/theme/testbubble/jot-header.tpl index 0093bf82a8..0d11da2717 100644 --- a/view/theme/testbubble/jot-header.tpl +++ b/view/theme/testbubble/jot-header.tpl @@ -4,10 +4,38 @@ var editor=false; var textlen = 0; +var plaintext = '$editselect'; function initEditor(cb) { if (editor==false) { $("#profile-jot-text-loading").show(); + if(plaintext == 'none') { + $("#profile-jot-text-loading").hide(); + $("#profile-jot-text").css({ 'height': 200, 'color': '#000' }); + $(".jothidden").show(); + editor = true; + $("a#jot-perms-icon").fancybox({ + 'transitionIn' : 'elastic', + 'transitionOut' : 'elastic' + }); + $("#profile-jot-submit-wrapper").show(); + {{ if $newpost }} + $("#profile-upload-wrapper").show(); + $("#profile-attach-wrapper").show(); + $("#profile-link-wrapper").show(); + $("#profile-video-wrapper").show(); + $("#profile-audio-wrapper").show(); + $("#profile-location-wrapper").show(); + $("#profile-nolocation-wrapper").show(); + $("#profile-title-wrapper").show(); + $("#profile-jot-plugin-wrapper").show(); + $("#jot-preview-link").show(); + {{ endif }} + + + if (typeof cb!="undefined") cb(); + return; + } tinyMCE.init({ theme : "advanced", mode : "specific_textareas", @@ -32,16 +60,37 @@ function initEditor(cb) { content_css: "$baseurl/view/custom_tinymce.css", theme_advanced_path : false, setup : function(ed) { - //Character count - ed.onKeyUp.add(function(ed, e) { - var txt = tinyMCE.activeEditor.getContent(); - textlen = txt.length; - if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) { - $('#profile-jot-desc').html(ispublic); - } - else { - $('#profile-jot-desc').html(' '); - } + 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; } + } + + textlen = txt.length; + if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) { + $('#profile-jot-desc').html(ispublic); + } + else { + $('#profile-jot-desc').html(' '); + } + + //Character count if(textlen <= 140) { $('#character-counter').removeClass('red'); @@ -62,19 +111,22 @@ function initEditor(cb) { }); ed.onInit.add(function(ed) { ed.pasteAsPlainText = true; - $("#profile-jot-text-loading").hide(); - $("#profile-jot-submit-wrapper").show(); - $("#profile-upload-wrapper").show(); - $("#profile-attach-wrapper").show(); - $("#profile-link-wrapper").show(); - $("#profile-youtube-wrapper").show(); - $("#profile-video-wrapper").show(); - $("#profile-audio-wrapper").show(); - $("#profile-location-wrapper").show(); - $("#profile-nolocation-wrapper").show(); - $("#profile-title-wrapper").show(); - $("#profile-jot-plugin-wrapper").show(); - $("#character-counter").show(); + $("#profile-jot-text-loading").hide(); + $(".jothidden").show(); + $("#profile-jot-submit-wrapper").show(); + {{ if $newpost }} + $("#profile-upload-wrapper").show(); + $("#profile-attach-wrapper").show(); + $("#profile-link-wrapper").show(); + $("#profile-video-wrapper").show(); + $("#profile-audio-wrapper").show(); + $("#profile-location-wrapper").show(); + $("#profile-nolocation-wrapper").show(); + $("#profile-title-wrapper").show(); + $("#profile-jot-plugin-wrapper").show(); + $("#jot-preview-link").show(); + {{ endif }} + $("#character-counter").show(); if (typeof cb!="undefined") cb(); }); } @@ -100,13 +152,15 @@ function initEditor(cb) { $(this).val(""); initEditor(); }); + + var uploader = new window.AjaxUpload( 'wall-image-upload', { action: 'wall_upload/$nickname', name: 'userfile', onSubmit: function(file,ext) { $('#profile-rotator').show(); }, onComplete: function(file,response) { - tinyMCE.execCommand('mceInsertRawHTML',false,response); + addeditortext(response); $('#profile-rotator').hide(); } } @@ -117,7 +171,7 @@ function initEditor(cb) { name: 'userfile', onSubmit: function(file,ext) { $('#profile-rotator').show(); }, onComplete: function(file,response) { - tinyMCE.execCommand('mceInsertRawHTML',false,response); + addeditortext(response); $('#profile-rotator').hide(); } } @@ -163,31 +217,24 @@ function initEditor(cb) { if(reply && reply.length) { reply = bin2hex(reply); $('#profile-rotator').show(); - $.get('parse_url?url=' + reply, function(data) { - tinyMCE.execCommand('mceInsertRawHTML',false,data); + $.get('parse_url?binurl=' + reply, function(data) { + addeditortext(data); $('#profile-rotator').hide(); }); } } - function jotGetVideo() { - reply = prompt("$utubeurl"); - if(reply && reply.length) { - tinyMCE.execCommand('mceInsertRawHTML',false,'[youtube]' + reply + '[/youtube]'); - } - } - function jotVideoURL() { reply = prompt("$vidurl"); if(reply && reply.length) { - tinyMCE.execCommand('mceInsertRawHTML',false,'[video]' + reply + '[/video]'); + addeditortext('[video]' + reply + '[/video]'); } } function jotAudioURL() { reply = prompt("$audurl"); if(reply && reply.length) { - tinyMCE.execCommand('mceInsertRawHTML',false,'[audio]' + reply + '[/audio]'); + addeditortext('[audio]' + reply + '[/audio]'); } } @@ -211,7 +258,7 @@ function initEditor(cb) { $.get('share/' + id, function(data) { if (!editor) $("#profile-jot-text").val(""); initEditor(function(){ - tinyMCE.execCommand('mceInsertRawHTML',false,data); + addeditortext(data); $('#like-rotator-' + id).hide(); $(window).scrollTop(0); }); @@ -229,22 +276,85 @@ function initEditor(cb) { event.target.textContent = reply; event.preventDefault(); if(reply && reply.length) { + reply = bin2hex(reply); $('#profile-rotator').show(); - $.get('parse_url?url=' + reply, function(data) { + $.get('parse_url?binurl=' + reply, function(data) { if (!editor) $("#profile-jot-text").val(""); initEditor(function(){ - tinyMCE.execCommand('mceInsertRawHTML',false,data); + addeditortext(data); $('#profile-rotator').hide(); }); }); } } + function itemTag(id) { + reply = prompt("$term"); + if(reply && reply.length) { + reply = reply.replace('#',''); + if(reply.length) { + + commentBusy = true; + $('body').css('cursor', 'wait'); + + $.get('tagger/' + id + '?term=' + reply); + if(timer) clearTimeout(timer); + timer = setTimeout(NavUpdate,3000); + liking = 1; + } + } + } + + function itemFiler(id) { + + var bordercolor = $("input").css("border-color"); + + $.get('filer/', function(data){ + $.fancybox(data); + $("#id_term").keypress(function(){ + $(this).css("border-color",bordercolor); + }) + $("#select_term").change(function(){ + $("#id_term").css("border-color",bordercolor); + }) + + $("#filer_save").click(function(e){ + e.preventDefault(); + reply = $("#id_term").val(); + if(reply && reply.length) { + commentBusy = true; + $('body').css('cursor', 'wait'); + $.get('filer/' + id + '?term=' + reply); + if(timer) clearTimeout(timer); + timer = setTimeout(NavUpdate,3000); + liking = 1; + $.fancybox.close(); + } else { + $("#id_term").css("border-color","#FF0000"); + } + return false; + }); + }); + + } + + + function jotClearLocation() { $('#jot-coord').val(''); $('#profile-nolocation-wrapper').hide(); } + function addeditortext(data) { + if(plaintext == 'none') { + var currentText = $("#profile-jot-text").val(); + $("#profile-jot-text").val(currentText + data); + } + else + tinyMCE.execCommand('mceInsertRawHTML',false,data); + } + + $geotag