3 <script language="javascript" type="text/javascript">
7 var plaintext = '{{$editselect}}';
9 function initEditor(cb){
11 $("#profile-jot-text-loading").show();
12 if(plaintext == 'none') {
13 $("#profile-jot-text-loading").hide();
14 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
15 $("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
17 $("a#jot-perms-icon").colorbox({
19 'transition' : 'elastic'
21 $(".jothidden").show();
22 if (typeof cb!="undefined") cb();
27 mode : "specific_textareas",
28 editor_selector: {{$editselect}},
29 auto_focus: "profile-jot-text",
30 plugins : "bbcode,paste,autoresize, inlinepopups",
31 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
32 theme_advanced_buttons2 : "",
33 theme_advanced_buttons3 : "",
34 theme_advanced_toolbar_location : "top",
35 theme_advanced_toolbar_align : "center",
36 theme_advanced_blockformats : "blockquote,code",
37 theme_advanced_resizing : true,
38 gecko_spellcheck : true,
39 paste_text_sticky : true,
40 entity_encoding : "raw",
41 add_unload_trigger : false,
42 remove_linebreaks : false,
43 //force_p_newlines : false,
44 //force_br_newlines : true,
45 forced_root_block : 'div',
47 content_css: "{{$baseurl}}/view/custom_tinymce.css",
48 theme_advanced_path : false,
49 file_browser_callback : "fcFileBrowser",
50 setup : function(ed) {
52 ed.onKeyDown.add(function(ed,e) {
57 ed.onKeyUp.add(function(ed, e) {
58 var txt = tinyMCE.activeEditor.getContent();
59 match = txt.match(/@([^ \n]+)$/);
62 cPopup = new ACPopup(this,baseurl+"/acl");
64 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
65 if(! cPopup.ready) cPopup = null;
68 if(cPopup !== null) { cPopup.close(); cPopup = null; }
72 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
73 $('#profile-jot-desc').html(ispublic);
76 $('#profile-jot-desc').html(' ');
82 $('#character-counter').removeClass('red');
83 $('#character-counter').removeClass('orange');
84 $('#character-counter').addClass('grey');
86 if((textlen > 140) && (textlen <= 420)) {
87 $('#character-counter').removeClass('grey');
88 $('#character-counter').removeClass('red');
89 $('#character-counter').addClass('orange');
92 $('#character-counter').removeClass('grey');
93 $('#character-counter').removeClass('orange');
94 $('#character-counter').addClass('red');
96 $('#character-counter').text(textlen);
99 ed.onInit.add(function(ed) {
100 ed.pasteAsPlainText = true;
101 $("#profile-jot-text-loading").hide();
102 $(".jothidden").show();
103 if (typeof cb!="undefined") cb();
110 $("a#jot-perms-icon").colorbox({
112 'transition' : 'elastic'
115 if (typeof cb!="undefined") cb();
119 function enableOnUser(){
126 <script type="text/javascript" src="{{$baseurl}}/js/ajaxupload.js" ></script>
128 var ispublic = '{{$ispublic}}';
131 $(document).ready(function() {
133 /* enable tinymce on focus and click */
134 $("#profile-jot-text").focus(enableOnUser);
135 $("#profile-jot-text").click(enableOnUser);
140 /* show images / file browser window
145 $('body').on('fbrowser.image.main', function(e, filename, embedcode, id) {
147 addeditortext(embedcode);
149 $('body').on('fbrowser.file.main', function(e, filename, embedcode, id) {
151 addeditortext(embedcode);
154 $('#wall-image-upload').on('click', function(){
155 Dialog.doImageBrowser("main");
158 $('#wall-file-upload').on('click', function(){
159 Dialog.doFileBrowser("main");
163 var uploader = new window.AjaxUpload(
165 { action: 'wall_upload/{{$nickname}}',
167 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
168 onComplete: function(file,response) {
169 addeditortext(response);
170 $('#profile-rotator').hide();
174 var file_uploader = new window.AjaxUpload(
176 { action: 'wall_attach/{{$nickname}}',
178 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
179 onComplete: function(file,response) {
180 addeditortext(response);
181 $('#profile-rotator').hide();
191 function deleteCheckedItems() {
192 if(confirm('{{$delitems}}')) {
195 $("#item-delete-selected").hide();
196 $('#item-delete-selected-rotator').show();
198 $('.item-select').each( function() {
199 if($(this).is(':checked')) {
200 if(checkedstr.length != 0) {
201 checkedstr = checkedstr + ',' + $(this).val();
204 checkedstr = $(this).val();
208 $.post('item', { dropitems: checkedstr }, function(data) {
209 window.location.reload();
214 function jotGetLink() {
215 reply = prompt("{{$linkurl}}");
216 if(reply && reply.length) {
217 reply = bin2hex(reply);
218 $('#profile-rotator').show();
219 $.get('parse_url?binurl=' + reply, function(data) {
221 $('#profile-rotator').hide();
226 function jotVideoURL() {
227 reply = prompt("{{$vidurl}}");
228 if(reply && reply.length) {
229 addeditortext('[video]' + reply + '[/video]');
233 function jotAudioURL() {
234 reply = prompt("{{$audurl}}");
235 if(reply && reply.length) {
236 addeditortext('[audio]' + reply + '[/audio]');
241 function jotGetLocation() {
242 reply = prompt("{{$whereareu}}", $('#jot-location').val());
243 if(reply && reply.length) {
244 $('#jot-location').val(reply);
248 function jotShare(id) {
249 if ($('#jot-popup').length != 0) $('#jot-popup').show();
251 $('#like-rotator-' + id).show();
252 $.get('share/' + id, function(data) {
253 if (!editor) $("#profile-jot-text").val("");
254 initEditor(function(){
256 $('#like-rotator-' + id).hide();
257 $(window).scrollTop(0);
263 function linkdropper(event) {
264 var linkFound = event.dataTransfer.types.contains("text/uri-list");
266 event.preventDefault();
269 function linkdrop(event) {
270 var reply = event.dataTransfer.getData("text/uri-list");
271 event.target.textContent = reply;
272 event.preventDefault();
273 if(reply && reply.length) {
274 reply = bin2hex(reply);
275 $('#profile-rotator').show();
276 $.get('parse_url?binurl=' + reply, function(data) {
277 if (!editor) $("#profile-jot-text").val("");
278 initEditor(function(){
280 $('#profile-rotator').hide();
286 function itemTag(id) {
287 reply = prompt("{{$term}}");
288 if(reply && reply.length) {
289 reply = reply.replace('#','');
293 $('body').css('cursor', 'wait');
295 $.get('tagger/' + id + '?term=' + reply);
296 if(timer) clearTimeout(timer);
297 timer = setTimeout(NavUpdate,3000);
303 function itemFiler(id) {
305 var bordercolor = $("input").css("border-color");
307 $.get('filer/', function(data){
308 $.colorbox({html:data});
309 $("#id_term").keypress(function(){
310 $(this).css("border-color",bordercolor);
312 $("#select_term").change(function(){
313 $("#id_term").css("border-color",bordercolor);
316 $("#filer_save").click(function(e){
318 reply = $("#id_term").val();
319 if(reply && reply.length) {
321 $('body').css('cursor', 'wait');
322 $.get('filer/' + id + '?term=' + reply, NavUpdate);
323 // if(timer) clearTimeout(timer);
324 // timer = setTimeout(NavUpdate,3000);
328 $("#id_term").css("border-color","#FF0000");
336 function jotClearLocation() {
337 $('#jot-coord').val('');
338 $('#profile-nolocation-wrapper').hide();
341 function addeditortext(data) {
342 if(plaintext == 'none') {
343 var currentText = $("#profile-jot-text").val();
344 $("#profile-jot-text").val(currentText + data);
347 tinyMCE.execCommand('mceInsertRawHTML',false,data);