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").editor_autocomplete(baseurl+"/acl");
16 $("#profile-jot-text").bbco_autocomplete('bbcode');
17 $(".jothidden").show();
19 $("a#jot-perms-icon").colorbox({
21 'transition' : 'elastic'
23 $("#profile-jot-submit-wrapper").show();
25 $("#profile-upload-wrapper").show();
26 $("#profile-attach-wrapper").show();
27 $("#profile-link-wrapper").show();
28 $("#profile-video-wrapper").show();
29 $("#profile-audio-wrapper").show();
30 $("#profile-location-wrapper").show();
31 $("#profile-nolocation-wrapper").show();
32 $("#profile-title-wrapper").show();
33 $("#profile-jot-plugin-wrapper").show();
34 $("#jot-preview-link").show();
38 if (typeof cb!="undefined") cb();
43 mode : "specific_textareas",
44 editor_selector: /(profile-jot-text|prvmail-text)/,
45 plugins : "bbcode,paste,fullscreen,autoresize",
46 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen",
47 theme_advanced_buttons2 : "",
48 theme_advanced_buttons3 : "",
49 theme_advanced_toolbar_location : "top",
50 theme_advanced_toolbar_align : "center",
51 theme_advanced_blockformats : "blockquote,code",
52 //theme_advanced_resizing : true,
53 //theme_advanced_statusbar_location : "bottom",
54 paste_text_sticky : true,
55 entity_encoding : "raw",
56 add_unload_trigger : false,
57 remove_linebreaks : false,
58 //force_p_newlines : false,
59 //force_br_newlines : true,
60 forced_root_block : 'div',
62 content_css: "{{$baseurl}}/view/custom_tinymce.css",
63 theme_advanced_path : false,
64 setup : function(ed) {
66 ed.onKeyDown.add(function(ed,e) {
73 ed.onKeyUp.add(function(ed, e) {
74 var txt = tinyMCE.activeEditor.getContent();
75 match = txt.match(/@([^ \n]+)$/);
78 cPopup = new ACPopup(this,baseurl+"/acl");
80 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
81 if(! cPopup.ready) cPopup = null;
84 if(cPopup !== null) { cPopup.close(); cPopup = null; }
88 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
89 $('#profile-jot-desc').html(ispublic);
92 $('#profile-jot-desc').html(' ');
98 $('#character-counter').removeClass('red');
99 $('#character-counter').removeClass('orange');
100 $('#character-counter').addClass('grey');
102 if((textlen > 140) && (textlen <= 420)) {
103 $('#character-counter').removeClass('grey');
104 $('#character-counter').removeClass('red');
105 $('#character-counter').addClass('orange');
108 $('#character-counter').removeClass('grey');
109 $('#character-counter').removeClass('orange');
110 $('#character-counter').addClass('red');
112 $('#character-counter').text(textlen);
114 ed.onInit.add(function(ed) {
115 ed.pasteAsPlainText = true;
116 $("#profile-jot-text-loading").hide();
117 $(".jothidden").show();
118 $("#profile-jot-submit-wrapper").show();
120 $("#profile-upload-wrapper").show();
121 $("#profile-attach-wrapper").show();
122 $("#profile-link-wrapper").show();
123 $("#profile-video-wrapper").show();
124 $("#profile-audio-wrapper").show();
125 $("#profile-location-wrapper").show();
126 $("#profile-nolocation-wrapper").show();
127 $("#profile-title-wrapper").show();
128 $("#profile-jot-plugin-wrapper").show();
129 $("#jot-preview-link").show();
131 $("#character-counter").show();
132 if (typeof cb!="undefined") cb();
138 $("a#jot-perms-icon").colorbox({
140 'transition' : 'elastic'
143 if (typeof cb!="undefined") cb();
147 function enableOnUser(){
155 <script type="text/javascript" src="js/ajaxupload.js" >
159 var ispublic = '{{$ispublic}}';
161 $(document).ready(function() {
163 /* enable tinymce on focus and click */
164 $("#profile-jot-text").focus(enableOnUser);
165 $("#profile-jot-text").click(enableOnUser);
167 var uploader = new window.AjaxUpload(
169 { action: 'wall_upload/{{$nickname}}',
171 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
172 onComplete: function(file,response) {
173 addeditortext(response);
174 $('#profile-rotator').hide();
179 var file_uploader = new window.AjaxUpload(
181 { action: 'wall_attach/{{$nickname}}',
183 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
184 onComplete: function(file,response) {
185 addeditortext(response);
186 $('#profile-rotator').hide();
190 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
192 $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
193 selstr = $(this).text();
194 $('#jot-perms-icon').removeClass('unlock').addClass('lock');
195 $('#jot-public').hide();
196 $('.profile-jot-net input').attr('disabled', 'disabled');
199 $('#jot-perms-icon').removeClass('lock').addClass('unlock');
200 $('#jot-public').show();
201 $('.profile-jot-net input').attr('disabled', false);
204 }).trigger('change');
208 function deleteCheckedItems() {
209 if(confirm('{{$delitems}}')) {
212 $("#item-delete-selected").hide();
213 $('#item-delete-selected-rotator').show();
215 $('.item-select').each( function() {
216 if($(this).is(':checked')) {
217 if(checkedstr.length != 0) {
218 checkedstr = checkedstr + ',' + $(this).val();
221 checkedstr = $(this).val();
225 $.post('item', { dropitems: checkedstr }, function(data) {
226 window.location.reload();
231 function jotGetLink() {
232 reply = prompt("{{$linkurl}}");
233 if(reply && reply.length) {
234 reply = bin2hex(reply);
235 $('#profile-rotator').show();
236 $.get('parse_url?binurl=' + reply, function(data) {
238 $('#profile-rotator').hide();
243 function jotVideoURL() {
244 reply = prompt("{{$vidurl}}");
245 if(reply && reply.length) {
246 addeditortext('[video]' + reply + '[/video]');
250 function jotAudioURL() {
251 reply = prompt("{{$audurl}}");
252 if(reply && reply.length) {
253 addeditortext('[audio]' + reply + '[/audio]');
258 function jotGetLocation() {
259 reply = prompt("{{$whereareu}}", $('#jot-location').val());
260 if(reply && reply.length) {
261 $('#jot-location').val(reply);
265 function jotTitle() {
266 reply = prompt("{{$title}}", $('#jot-title').val());
267 if(reply && reply.length) {
268 $('#jot-title').val(reply);
272 function jotShare(id) {
273 $('#like-rotator-' + id).show();
274 $.get('share/' + id, function(data) {
275 if (!editor) $("#profile-jot-text").val("");
276 initEditor(function(){
278 $('#like-rotator-' + id).hide();
279 $(window).scrollTop(0);
284 function linkdropper(event) {
285 var linkFound = event.dataTransfer.types.contains("text/uri-list");
287 event.preventDefault();
290 function linkdrop(event) {
291 var reply = event.dataTransfer.getData("text/uri-list");
292 event.target.textContent = reply;
293 event.preventDefault();
294 if(reply && reply.length) {
295 reply = bin2hex(reply);
296 $('#profile-rotator').show();
297 $.get('parse_url?binurl=' + reply, function(data) {
298 if (!editor) $("#profile-jot-text").val("");
299 initEditor(function(){
301 $('#profile-rotator').hide();
307 function itemTag(id) {
308 reply = prompt("{{$term}}");
309 if(reply && reply.length) {
310 reply = reply.replace('#','');
314 $('body').css('cursor', 'wait');
316 $.get('tagger/' + id + '?term=' + reply);
317 if(timer) clearTimeout(timer);
318 timer = setTimeout(NavUpdate,3000);
324 function itemFiler(id) {
326 var bordercolor = $("input").css("border-color");
328 $.get('filer/', function(data){
329 $.colorbox({html:data});
330 $("#id_term").keypress(function(){
331 $(this).css("border-color",bordercolor);
333 $("#select_term").change(function(){
334 $("#id_term").css("border-color",bordercolor);
337 $("#filer_save").click(function(e){
339 reply = $("#id_term").val();
340 if(reply && reply.length) {
342 $('body').css('cursor', 'wait');
343 $.get('filer/' + id + '?term=' + reply, NavUpdate);
344 // if(timer) clearTimeout(timer);
345 // timer = setTimeout(NavUpdate,3000);
349 $("#id_term").css("border-color","#FF0000");
359 function jotClearLocation() {
360 $('#jot-coord').val('');
361 $('#profile-nolocation-wrapper').hide();
364 function addeditortext(data) {
365 if(plaintext == 'none') {
366 var currentText = $("#profile-jot-text").val();
367 $("#profile-jot-text").val(currentText + data);
370 tinyMCE.execCommand('mceInsertRawHTML',false,data);