3 <script language="javascript" type="text/javascript">
7 var plaintext = '{{$editselect}}';
9 function initEditor(cb){
11 var colorbox_options = {
12 {{if $APP->is_mobile}}
17 'transition' : 'elastic'
22 $("#profile-jot-text-loading").show();
23 if(plaintext == 'none') {
24 $("#profile-jot-text-loading").hide();
25 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
26 $("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
27 $("#profile-jot-text").bbco_autocomplete('bbcode');
29 $("a#jot-perms-icon").colorbox(colorbox_options);
30 $(".jothidden").show();
31 if (typeof cb!="undefined") cb();
36 mode : "specific_textareas",
37 editor_selector: {{$editselect}},
38 auto_focus: "profile-jot-text",
39 plugins : "bbcode,paste,autoresize, inlinepopups",
40 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
41 theme_advanced_buttons2 : "",
42 theme_advanced_buttons3 : "",
43 theme_advanced_toolbar_location : "top",
44 theme_advanced_toolbar_align : "center",
45 theme_advanced_blockformats : "blockquote,code",
46 theme_advanced_resizing : true,
47 gecko_spellcheck : true,
48 paste_text_sticky : true,
49 entity_encoding : "raw",
50 add_unload_trigger : false,
51 remove_linebreaks : false,
52 //force_p_newlines : false,
53 //force_br_newlines : true,
54 forced_root_block : 'div',
56 content_css: "{{$baseurl}}/view/custom_tinymce.css",
57 theme_advanced_path : false,
58 file_browser_callback : "fcFileBrowser",
59 setup : function(ed) {
61 ed.onKeyDown.add(function(ed,e) {
66 ed.onKeyUp.add(function(ed, e) {
67 var txt = tinyMCE.activeEditor.getContent();
68 match = txt.match(/@([^ \n]+)$/);
71 cPopup = new ACPopup(this,baseurl+"/acl");
73 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
74 if(! cPopup.ready) cPopup = null;
77 if(cPopup !== null) { cPopup.close(); cPopup = null; }
81 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
82 $('#profile-jot-desc').html(ispublic);
85 $('#profile-jot-desc').html(' ');
91 $('#character-counter').removeClass('red');
92 $('#character-counter').removeClass('orange');
93 $('#character-counter').addClass('grey');
95 if((textlen > 140) && (textlen <= 420)) {
96 $('#character-counter').removeClass('grey');
97 $('#character-counter').removeClass('red');
98 $('#character-counter').addClass('orange');
101 $('#character-counter').removeClass('grey');
102 $('#character-counter').removeClass('orange');
103 $('#character-counter').addClass('red');
105 $('#character-counter').text(textlen);
108 ed.onInit.add(function(ed) {
109 ed.pasteAsPlainText = true;
110 $("#profile-jot-text-loading").hide();
111 $(".jothidden").show();
112 if (typeof cb!="undefined") cb();
119 $("a#jot-perms-icon").colorbox(colorbox_options);
121 if (typeof cb!="undefined") cb();
125 function enableOnUser(){
132 <script type="text/javascript" src="{{$baseurl}}/js/ajaxupload.js" ></script>
134 var ispublic = '{{$ispublic}}';
137 $(document).ready(function() {
139 /* enable tinymce on focus and click */
140 $("#profile-jot-text").focus(enableOnUser);
141 $("#profile-jot-text").click(enableOnUser);
146 /* show images / file browser window
151 $('body').on('fbrowser.image.main', function(e, filename, embedcode, id) {
153 addeditortext(embedcode);
155 $('body').on('fbrowser.file.main', function(e, filename, embedcode, id) {
157 addeditortext(embedcode);
160 $('#wall-image-upload').on('click', function(){
161 Dialog.doImageBrowser("main");
164 $('#wall-file-upload').on('click', function(){
165 Dialog.doFileBrowser("main");
169 var uploader = new window.AjaxUpload(
171 { action: 'wall_upload/{{$nickname}}',
173 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
174 onComplete: function(file,response) {
175 addeditortext(response);
176 $('#profile-rotator').hide();
180 var file_uploader = new window.AjaxUpload(
182 { action: 'wall_attach/{{$nickname}}',
184 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
185 onComplete: function(file,response) {
186 addeditortext(response);
187 $('#profile-rotator').hide();
197 function deleteCheckedItems() {
198 if(confirm('{{$delitems}}')) {
201 $("#item-delete-selected").hide();
202 $('#item-delete-selected-rotator').show();
204 $('.item-select').each( function() {
205 if($(this).is(':checked')) {
206 if(checkedstr.length != 0) {
207 checkedstr = checkedstr + ',' + $(this).val();
210 checkedstr = $(this).val();
214 $.post('item', { dropitems: checkedstr }, function(data) {
215 window.location.reload();
220 function jotGetLink() {
221 reply = prompt("{{$linkurl}}");
222 if(reply && reply.length) {
223 reply = bin2hex(reply);
224 $('#profile-rotator').show();
225 $.get('parse_url?binurl=' + reply, function(data) {
227 $('#profile-rotator').hide();
232 function jotVideoURL() {
233 reply = prompt("{{$vidurl}}");
234 if(reply && reply.length) {
235 addeditortext('[video]' + reply + '[/video]');
239 function jotAudioURL() {
240 reply = prompt("{{$audurl}}");
241 if(reply && reply.length) {
242 addeditortext('[audio]' + reply + '[/audio]');
247 function jotGetLocation() {
248 reply = prompt("{{$whereareu}}", $('#jot-location').val());
249 if(reply && reply.length) {
250 $('#jot-location').val(reply);
254 function jotShare(id) {
255 if ($('#jot-popup').length != 0) $('#jot-popup').show();
257 $('#like-rotator-' + id).show();
258 $.get('share/' + id, function(data) {
259 if (!editor) $("#profile-jot-text").val("");
260 initEditor(function(){
262 $('#like-rotator-' + id).hide();
263 $(window).scrollTop(0);
269 function linkdropper(event) {
270 var linkFound = event.dataTransfer.types.contains("text/uri-list");
272 event.preventDefault();
275 function linkdrop(event) {
276 var reply = event.dataTransfer.getData("text/uri-list");
277 event.target.textContent = reply;
278 event.preventDefault();
279 if(reply && reply.length) {
280 reply = bin2hex(reply);
281 $('#profile-rotator').show();
282 $.get('parse_url?binurl=' + reply, function(data) {
283 if (!editor) $("#profile-jot-text").val("");
284 initEditor(function(){
286 $('#profile-rotator').hide();
292 function itemTag(id) {
293 reply = prompt("{{$term}}");
294 if(reply && reply.length) {
295 reply = reply.replace('#','');
299 $('body').css('cursor', 'wait');
301 $.get('tagger/' + id + '?term=' + reply);
302 if(timer) clearTimeout(timer);
303 timer = setTimeout(NavUpdate,3000);
309 function itemFiler(id) {
311 var bordercolor = $("input").css("border-color");
313 $.get('filer/', function(data){
314 $.colorbox({html:data});
315 $("#id_term").keypress(function(){
316 $(this).css("border-color",bordercolor);
318 $("#select_term").change(function(){
319 $("#id_term").css("border-color",bordercolor);
322 $("#filer_save").click(function(e){
324 reply = $("#id_term").val();
325 if(reply && reply.length) {
327 $('body').css('cursor', 'wait');
328 $.get('filer/' + id + '?term=' + reply, NavUpdate);
329 // if(timer) clearTimeout(timer);
330 // timer = setTimeout(NavUpdate,3000);
334 $("#id_term").css("border-color","#FF0000");
342 function jotClearLocation() {
343 $('#jot-coord').val('');
344 $('#profile-nolocation-wrapper').hide();
347 function addeditortext(data) {
348 if(plaintext == 'none') {
349 var currentText = $("#profile-jot-text").val();
350 $("#profile-jot-text").val(currentText + data);
353 tinyMCE.execCommand('mceInsertRawHTML',false,data);