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");
16 $(".jothidden").show();
18 $("a#jot-perms-icon").colorbox({
20 'transition' : 'elastic'
22 $("#profile-jot-submit-wrapper").show();
24 $("#profile-upload-wrapper").show();
25 $("#profile-attach-wrapper").show();
26 $("#profile-link-wrapper").show();
27 $("#profile-video-wrapper").show();
28 $("#profile-audio-wrapper").show();
29 $("#profile-location-wrapper").show();
30 $("#profile-nolocation-wrapper").show();
31 $("#profile-title-wrapper").show();
32 $("#profile-jot-plugin-wrapper").show();
33 $("#jot-preview-link").show();
37 if (typeof cb!="undefined") cb();
42 mode : "specific_textareas",
43 editor_selector: /(profile-jot-text|prvmail-text)/,
44 plugins : "bbcode,paste,fullscreen,autoresize",
45 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen",
46 theme_advanced_buttons2 : "",
47 theme_advanced_buttons3 : "",
48 theme_advanced_toolbar_location : "top",
49 theme_advanced_toolbar_align : "center",
50 theme_advanced_blockformats : "blockquote,code",
51 //theme_advanced_resizing : true,
52 //theme_advanced_statusbar_location : "bottom",
53 paste_text_sticky : true,
54 entity_encoding : "raw",
55 add_unload_trigger : false,
56 remove_linebreaks : false,
57 //force_p_newlines : false,
58 //force_br_newlines : true,
59 forced_root_block : 'div',
61 content_css: "{{$baseurl}}/view/custom_tinymce.css",
62 theme_advanced_path : false,
63 setup : function(ed) {
65 ed.onKeyDown.add(function(ed,e) {
72 ed.onKeyUp.add(function(ed, e) {
73 var txt = tinyMCE.activeEditor.getContent();
74 match = txt.match(/@([^ \n]+)$/);
77 cPopup = new ACPopup(this,baseurl+"/acl");
79 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
80 if(! cPopup.ready) cPopup = null;
83 if(cPopup !== null) { cPopup.close(); cPopup = null; }
87 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
88 $('#profile-jot-desc').html(ispublic);
91 $('#profile-jot-desc').html(' ');
97 $('#character-counter').removeClass('red');
98 $('#character-counter').removeClass('orange');
99 $('#character-counter').addClass('grey');
101 if((textlen > 140) && (textlen <= 420)) {
102 $('#character-counter').removeClass('grey');
103 $('#character-counter').removeClass('red');
104 $('#character-counter').addClass('orange');
107 $('#character-counter').removeClass('grey');
108 $('#character-counter').removeClass('orange');
109 $('#character-counter').addClass('red');
111 $('#character-counter').text(textlen);
113 ed.onInit.add(function(ed) {
114 ed.pasteAsPlainText = true;
115 $("#profile-jot-text-loading").hide();
116 $(".jothidden").show();
117 $("#profile-jot-submit-wrapper").show();
119 $("#profile-upload-wrapper").show();
120 $("#profile-attach-wrapper").show();
121 $("#profile-link-wrapper").show();
122 $("#profile-video-wrapper").show();
123 $("#profile-audio-wrapper").show();
124 $("#profile-location-wrapper").show();
125 $("#profile-nolocation-wrapper").show();
126 $("#profile-title-wrapper").show();
127 $("#profile-jot-plugin-wrapper").show();
128 $("#jot-preview-link").show();
130 $("#character-counter").show();
131 if (typeof cb!="undefined") cb();
137 $("a#jot-perms-icon").colorbox({
139 'transition' : 'elastic'
142 if (typeof cb!="undefined") cb();
146 function enableOnUser(){
154 <script type="text/javascript" src="js/ajaxupload.js" >
158 var ispublic = '{{$ispublic}}';
160 $(document).ready(function() {
162 /* enable tinymce on focus and click */
163 $("#profile-jot-text").focus(enableOnUser);
164 $("#profile-jot-text").click(enableOnUser);
166 var uploader = new window.AjaxUpload(
168 { action: 'wall_upload/{{$nickname}}',
170 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
171 onComplete: function(file,response) {
172 addeditortext(response);
173 $('#profile-rotator').hide();
178 var file_uploader = new window.AjaxUpload(
180 { action: 'wall_attach/{{$nickname}}',
182 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
183 onComplete: function(file,response) {
184 addeditortext(response);
185 $('#profile-rotator').hide();
189 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
191 $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
192 selstr = $(this).text();
193 $('#jot-perms-icon').removeClass('unlock').addClass('lock');
194 $('#jot-public').hide();
195 $('.profile-jot-net input').attr('disabled', 'disabled');
198 $('#jot-perms-icon').removeClass('lock').addClass('unlock');
199 $('#jot-public').show();
200 $('.profile-jot-net input').attr('disabled', false);
203 }).trigger('change');
207 function deleteCheckedItems() {
208 if(confirm('{{$delitems}}')) {
211 $("#item-delete-selected").hide();
212 $('#item-delete-selected-rotator').show();
214 $('.item-select').each( function() {
215 if($(this).is(':checked')) {
216 if(checkedstr.length != 0) {
217 checkedstr = checkedstr + ',' + $(this).val();
220 checkedstr = $(this).val();
224 $.post('item', { dropitems: checkedstr }, function(data) {
225 window.location.reload();
230 function jotGetLink() {
231 reply = prompt("{{$linkurl}}");
232 if(reply && reply.length) {
233 reply = bin2hex(reply);
234 $('#profile-rotator').show();
235 $.get('parse_url?binurl=' + reply, function(data) {
237 $('#profile-rotator').hide();
242 function jotVideoURL() {
243 reply = prompt("{{$vidurl}}");
244 if(reply && reply.length) {
245 addeditortext('[video]' + reply + '[/video]');
249 function jotAudioURL() {
250 reply = prompt("{{$audurl}}");
251 if(reply && reply.length) {
252 addeditortext('[audio]' + reply + '[/audio]');
257 function jotGetLocation() {
258 reply = prompt("{{$whereareu}}", $('#jot-location').val());
259 if(reply && reply.length) {
260 $('#jot-location').val(reply);
264 function jotTitle() {
265 reply = prompt("{{$title}}", $('#jot-title').val());
266 if(reply && reply.length) {
267 $('#jot-title').val(reply);
271 function jotShare(id) {
272 $('#like-rotator-' + id).show();
273 $.get('share/' + id, function(data) {
274 if (!editor) $("#profile-jot-text").val("");
275 initEditor(function(){
277 $('#like-rotator-' + id).hide();
278 $(window).scrollTop(0);
283 function linkdropper(event) {
284 var linkFound = event.dataTransfer.types.contains("text/uri-list");
286 event.preventDefault();
289 function linkdrop(event) {
290 var reply = event.dataTransfer.getData("text/uri-list");
291 event.target.textContent = reply;
292 event.preventDefault();
293 if(reply && reply.length) {
294 reply = bin2hex(reply);
295 $('#profile-rotator').show();
296 $.get('parse_url?binurl=' + reply, function(data) {
297 if (!editor) $("#profile-jot-text").val("");
298 initEditor(function(){
300 $('#profile-rotator').hide();
306 function itemTag(id) {
307 reply = prompt("{{$term}}");
308 if(reply && reply.length) {
309 reply = reply.replace('#','');
313 $('body').css('cursor', 'wait');
315 $.get('tagger/' + id + '?term=' + reply);
316 if(timer) clearTimeout(timer);
317 timer = setTimeout(NavUpdate,3000);
323 function itemFiler(id) {
325 var bordercolor = $("input").css("border-color");
327 $.get('filer/', function(data){
328 $.colorbox({html:data});
329 $("#id_term").keypress(function(){
330 $(this).css("border-color",bordercolor);
332 $("#select_term").change(function(){
333 $("#id_term").css("border-color",bordercolor);
336 $("#filer_save").click(function(e){
338 reply = $("#id_term").val();
339 if(reply && reply.length) {
341 $('body').css('cursor', 'wait');
342 $.get('filer/' + id + '?term=' + reply, NavUpdate);
343 // if(timer) clearTimeout(timer);
344 // timer = setTimeout(NavUpdate,3000);
348 $("#id_term").css("border-color","#FF0000");
358 function jotClearLocation() {
359 $('#jot-coord').val('');
360 $('#profile-nolocation-wrapper').hide();
363 function addeditortext(data) {
364 if(plaintext == 'none') {
365 var currentText = $("#profile-jot-text").val();
366 $("#profile-jot-text").val(currentText + data);
369 tinyMCE.execCommand('mceInsertRawHTML',false,data);