2 * AUTOMATICALLY GENERATED TEMPLATE
3 * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
7 <script language="javascript" type="text/javascript">
11 var plaintext = '{{$editselect}}';
13 function initEditor(cb){
15 $("#profile-jot-text-loading").show();
16 if(plaintext == 'none') {
17 $("#profile-jot-text-loading").hide();
18 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
19 $("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
20 $(".jothidden").show();
22 $("a#jot-perms-icon").colorbox({
24 'transition' : 'elastic'
26 $("#profile-jot-submit-wrapper").show();
28 $("#profile-upload-wrapper").show();
29 $("#profile-attach-wrapper").show();
30 $("#profile-link-wrapper").show();
31 $("#profile-video-wrapper").show();
32 $("#profile-audio-wrapper").show();
33 $("#profile-location-wrapper").show();
34 $("#profile-nolocation-wrapper").show();
35 $("#profile-title-wrapper").show();
36 $("#profile-jot-plugin-wrapper").show();
37 $("#jot-preview-link").show();
41 if (typeof cb!="undefined") cb();
46 mode : "specific_textareas",
47 editor_selector: /(profile-jot-text|prvmail-text)/,
48 plugins : "bbcode,paste,fullscreen,autoresize",
49 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen",
50 theme_advanced_buttons2 : "",
51 theme_advanced_buttons3 : "",
52 theme_advanced_toolbar_location : "top",
53 theme_advanced_toolbar_align : "center",
54 theme_advanced_blockformats : "blockquote,code",
55 //theme_advanced_resizing : true,
56 //theme_advanced_statusbar_location : "bottom",
57 paste_text_sticky : true,
58 entity_encoding : "raw",
59 add_unload_trigger : false,
60 remove_linebreaks : false,
61 //force_p_newlines : false,
62 //force_br_newlines : true,
63 forced_root_block : 'div',
65 content_css: "{{$baseurl}}/view/custom_tinymce.css",
66 theme_advanced_path : false,
67 setup : function(ed) {
69 ed.onKeyDown.add(function(ed,e) {
76 ed.onKeyUp.add(function(ed, e) {
77 var txt = tinyMCE.activeEditor.getContent();
78 match = txt.match(/@([^ \n]+)$/);
81 cPopup = new ACPopup(this,baseurl+"/acl");
83 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
84 if(! cPopup.ready) cPopup = null;
87 if(cPopup !== null) { cPopup.close(); cPopup = null; }
91 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
92 $('#profile-jot-desc').html(ispublic);
95 $('#profile-jot-desc').html(' ');
101 $('#character-counter').removeClass('red');
102 $('#character-counter').removeClass('orange');
103 $('#character-counter').addClass('grey');
105 if((textlen > 140) && (textlen <= 420)) {
106 $('#character-counter').removeClass('grey');
107 $('#character-counter').removeClass('red');
108 $('#character-counter').addClass('orange');
111 $('#character-counter').removeClass('grey');
112 $('#character-counter').removeClass('orange');
113 $('#character-counter').addClass('red');
115 $('#character-counter').text(textlen);
117 ed.onInit.add(function(ed) {
118 ed.pasteAsPlainText = true;
119 $("#profile-jot-text-loading").hide();
120 $(".jothidden").show();
121 $("#profile-jot-submit-wrapper").show();
123 $("#profile-upload-wrapper").show();
124 $("#profile-attach-wrapper").show();
125 $("#profile-link-wrapper").show();
126 $("#profile-video-wrapper").show();
127 $("#profile-audio-wrapper").show();
128 $("#profile-location-wrapper").show();
129 $("#profile-nolocation-wrapper").show();
130 $("#profile-title-wrapper").show();
131 $("#profile-jot-plugin-wrapper").show();
132 $("#jot-preview-link").show();
134 $("#character-counter").show();
135 if (typeof cb!="undefined") cb();
141 $("a#jot-perms-icon").colorbox({
143 'transition' : 'elastic'
146 if (typeof cb!="undefined") cb();
150 function enableOnUser(){
158 <script type="text/javascript" src="js/ajaxupload.js" >
162 var ispublic = '{{$ispublic}}';
164 $(document).ready(function() {
166 /* enable tinymce on focus and click */
167 $("#profile-jot-text").focus(enableOnUser);
168 $("#profile-jot-text").click(enableOnUser);
170 var uploader = new window.AjaxUpload(
172 { action: 'wall_upload/{{$nickname}}',
174 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
175 onComplete: function(file,response) {
176 addeditortext(response);
177 $('#profile-rotator').hide();
182 var file_uploader = new window.AjaxUpload(
184 { action: 'wall_attach/{{$nickname}}',
186 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
187 onComplete: function(file,response) {
188 addeditortext(response);
189 $('#profile-rotator').hide();
193 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
195 $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
196 selstr = $(this).text();
197 $('#jot-perms-icon').removeClass('unlock').addClass('lock');
198 $('#jot-public').hide();
199 $('.profile-jot-net input').attr('disabled', 'disabled');
202 $('#jot-perms-icon').removeClass('lock').addClass('unlock');
203 $('#jot-public').show();
204 $('.profile-jot-net input').attr('disabled', false);
207 }).trigger('change');
211 function deleteCheckedItems() {
212 if(confirm('{{$delitems}}')) {
215 $("#item-delete-selected").hide();
216 $('#item-delete-selected-rotator').show();
218 $('.item-select').each( function() {
219 if($(this).is(':checked')) {
220 if(checkedstr.length != 0) {
221 checkedstr = checkedstr + ',' + $(this).val();
224 checkedstr = $(this).val();
228 $.post('item', { dropitems: checkedstr }, function(data) {
229 window.location.reload();
234 function jotGetLink() {
235 reply = prompt("{{$linkurl}}");
236 if(reply && reply.length) {
237 reply = bin2hex(reply);
238 $('#profile-rotator').show();
239 $.get('parse_url?binurl=' + reply, function(data) {
241 $('#profile-rotator').hide();
246 function jotVideoURL() {
247 reply = prompt("{{$vidurl}}");
248 if(reply && reply.length) {
249 addeditortext('[video]' + reply + '[/video]');
253 function jotAudioURL() {
254 reply = prompt("{{$audurl}}");
255 if(reply && reply.length) {
256 addeditortext('[audio]' + reply + '[/audio]');
261 function jotGetLocation() {
262 reply = prompt("{{$whereareu}}", $('#jot-location').val());
263 if(reply && reply.length) {
264 $('#jot-location').val(reply);
268 function jotTitle() {
269 reply = prompt("{{$title}}", $('#jot-title').val());
270 if(reply && reply.length) {
271 $('#jot-title').val(reply);
275 function jotShare(id) {
276 $('#like-rotator-' + id).show();
277 $.get('share/' + id, function(data) {
278 if (!editor) $("#profile-jot-text").val("");
279 initEditor(function(){
281 $('#like-rotator-' + id).hide();
282 $(window).scrollTop(0);
287 function linkdropper(event) {
288 var linkFound = event.dataTransfer.types.contains("text/uri-list");
290 event.preventDefault();
293 function linkdrop(event) {
294 var reply = event.dataTransfer.getData("text/uri-list");
295 event.target.textContent = reply;
296 event.preventDefault();
297 if(reply && reply.length) {
298 reply = bin2hex(reply);
299 $('#profile-rotator').show();
300 $.get('parse_url?binurl=' + reply, function(data) {
301 if (!editor) $("#profile-jot-text").val("");
302 initEditor(function(){
304 $('#profile-rotator').hide();
310 function itemTag(id) {
311 reply = prompt("{{$term}}");
312 if(reply && reply.length) {
313 reply = reply.replace('#','');
317 $('body').css('cursor', 'wait');
319 $.get('tagger/' + id + '?term=' + reply);
320 if(timer) clearTimeout(timer);
321 timer = setTimeout(NavUpdate,3000);
327 function itemFiler(id) {
329 var bordercolor = $("input").css("border-color");
331 $.get('filer/', function(data){
332 $.colorbox({html:data});
333 $("#id_term").keypress(function(){
334 $(this).css("border-color",bordercolor);
336 $("#select_term").change(function(){
337 $("#id_term").css("border-color",bordercolor);
340 $("#filer_save").click(function(e){
342 reply = $("#id_term").val();
343 if(reply && reply.length) {
345 $('body').css('cursor', 'wait');
346 $.get('filer/' + id + '?term=' + reply, NavUpdate);
347 // if(timer) clearTimeout(timer);
348 // timer = setTimeout(NavUpdate,3000);
352 $("#id_term").css("border-color","#FF0000");
362 function jotClearLocation() {
363 $('#jot-coord').val('');
364 $('#profile-nolocation-wrapper').hide();
367 function addeditortext(data) {
368 if(plaintext == 'none') {
369 var currentText = $("#profile-jot-text").val();
370 $("#profile-jot-text").val(currentText + data);
373 tinyMCE.execCommand('mceInsertRawHTML',false,data);