2 <script language="javascript" type="text/javascript">
6 var plaintext = '$editselect';
8 function initEditor(cb){
10 $("#profile-jot-text-loading").show();
11 if(plaintext == 'none') {
12 $("#profile-jot-text-loading").hide();
13 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
14 $("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
15 $(".jothidden").show();
17 $("a#jot-perms-icon").fancybox({
18 'transitionIn' : 'elastic',
19 'transitionOut' : 'elastic'
21 $("#profile-jot-submit-wrapper").show();
23 $("#profile-upload-wrapper").show();
24 $("#profile-attach-wrapper").show();
25 $("#profile-link-wrapper").show();
26 $("#profile-video-wrapper").show();
27 $("#profile-audio-wrapper").show();
28 $("#profile-location-wrapper").show();
29 $("#profile-nolocation-wrapper").show();
30 $("#profile-title-wrapper").show();
31 $("#profile-jot-plugin-wrapper").show();
32 $("#jot-preview-link").show();
36 if (typeof cb!="undefined") cb();
41 mode : "specific_textareas",
42 editor_selector: /(profile-jot-text|prvmail-text)/,
43 plugins : "bbcode,paste,fullscreen,autoresize",
44 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen",
45 theme_advanced_buttons2 : "",
46 theme_advanced_buttons3 : "",
47 theme_advanced_toolbar_location : "top",
48 theme_advanced_toolbar_align : "center",
49 theme_advanced_blockformats : "blockquote,code",
50 //theme_advanced_resizing : true,
51 //theme_advanced_statusbar_location : "bottom",
52 paste_text_sticky : true,
53 entity_encoding : "raw",
54 add_unload_trigger : false,
55 remove_linebreaks : false,
56 force_p_newlines : false,
57 force_br_newlines : true,
58 forced_root_block : '',
60 content_css: "$baseurl/view/custom_tinymce.css",
61 theme_advanced_path : false,
62 setup : function(ed) {
64 ed.onKeyDown.add(function(ed,e) {
71 ed.onKeyUp.add(function(ed, e) {
72 var txt = tinyMCE.activeEditor.getContent();
73 match = txt.match(/@([^ \n]+)$/);
76 cPopup = new ACPopup(this,baseurl+"/acl");
78 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
79 if(! cPopup.ready) cPopup = null;
82 if(cPopup !== null) { cPopup.close(); cPopup = null; }
86 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
87 $('#profile-jot-desc').html(ispublic);
90 $('#profile-jot-desc').html(' ');
96 $('#character-counter').removeClass('red');
97 $('#character-counter').removeClass('orange');
98 $('#character-counter').addClass('grey');
100 if((textlen > 140) && (textlen <= 420)) {
101 $('#character-counter').removeClass('grey');
102 $('#character-counter').removeClass('red');
103 $('#character-counter').addClass('orange');
106 $('#character-counter').removeClass('grey');
107 $('#character-counter').removeClass('orange');
108 $('#character-counter').addClass('red');
110 $('#character-counter').text(textlen);
112 ed.onInit.add(function(ed) {
113 ed.pasteAsPlainText = true;
114 $("#profile-jot-text-loading").hide();
115 $(".jothidden").show();
116 $("#profile-jot-submit-wrapper").show();
118 $("#profile-upload-wrapper").show();
119 $("#profile-attach-wrapper").show();
120 $("#profile-link-wrapper").show();
121 $("#profile-video-wrapper").show();
122 $("#profile-audio-wrapper").show();
123 $("#profile-location-wrapper").show();
124 $("#profile-nolocation-wrapper").show();
125 $("#profile-title-wrapper").show();
126 $("#profile-jot-plugin-wrapper").show();
127 $("#jot-preview-link").show();
129 $("#character-counter").show();
130 if (typeof cb!="undefined") cb();
136 $("a#jot-perms-icon").fancybox({
137 'transitionIn' : 'none',
138 'transitionOut' : 'none'
141 if (typeof cb!="undefined") cb();
145 function enableOnUser(){
153 <script type="text/javascript" src="js/ajaxupload.js" >
157 var ispublic = '$ispublic';
159 $(document).ready(function() {
161 /* enable tinymce on focus and click */
162 $("#profile-jot-text").focus(enableOnUser);
163 $("#profile-jot-text").click(enableOnUser);
165 var uploader = new window.AjaxUpload(
167 { action: 'wall_upload/$nickname',
169 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
170 onComplete: function(file,response) {
171 addeditortext(response);
172 $('#profile-rotator').hide();
177 var file_uploader = new window.AjaxUpload(
179 { action: 'wall_attach/$nickname',
181 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
182 onComplete: function(file,response) {
183 addeditortext(response);
184 $('#profile-rotator').hide();
188 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
190 $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
191 selstr = $(this).text();
192 $('#jot-perms-icon').removeClass('unlock').addClass('lock');
193 $('#jot-public').hide();
194 $('.profile-jot-net input').attr('disabled', 'disabled');
197 $('#jot-perms-icon').removeClass('lock').addClass('unlock');
198 $('#jot-public').show();
199 $('.profile-jot-net input').attr('disabled', false);
202 }).trigger('change');
206 function deleteCheckedItems() {
207 if(confirm('$delitems')) {
210 $("#item-delete-selected").hide();
211 $('#item-delete-selected-rotator').show();
213 $('.item-select').each( function() {
214 if($(this).is(':checked')) {
215 if(checkedstr.length != 0) {
216 checkedstr = checkedstr + ',' + $(this).val();
219 checkedstr = $(this).val();
223 $.post('item', { dropitems: checkedstr }, function(data) {
224 window.location.reload();
229 function jotGetLink() {
230 reply = prompt("$linkurl");
231 if(reply && reply.length) {
232 reply = bin2hex(reply);
233 $('#profile-rotator').show();
234 $.get('parse_url?binurl=' + reply, function(data) {
236 $('#profile-rotator').hide();
241 function jotVideoURL() {
242 reply = prompt("$vidurl");
243 if(reply && reply.length) {
244 addeditortext('[video]' + reply + '[/video]');
248 function jotAudioURL() {
249 reply = prompt("$audurl");
250 if(reply && reply.length) {
251 addeditortext('[audio]' + reply + '[/audio]');
256 function jotGetLocation() {
257 reply = prompt("$whereareu", $('#jot-location').val());
258 if(reply && reply.length) {
259 $('#jot-location').val(reply);
263 function jotTitle() {
264 reply = prompt("$title", $('#jot-title').val());
265 if(reply && reply.length) {
266 $('#jot-title').val(reply);
270 function jotShare(id) {
271 $('#like-rotator-' + id).show();
272 $.get('share/' + id, function(data) {
273 if (!editor) $("#profile-jot-text").val("");
274 initEditor(function(){
276 $('#like-rotator-' + id).hide();
277 $(window).scrollTop(0);
282 function linkdropper(event) {
283 var linkFound = event.dataTransfer.types.contains("text/uri-list");
285 event.preventDefault();
288 function linkdrop(event) {
289 var reply = event.dataTransfer.getData("text/uri-list");
290 event.target.textContent = reply;
291 event.preventDefault();
292 if(reply && reply.length) {
293 reply = bin2hex(reply);
294 $('#profile-rotator').show();
295 $.get('parse_url?binurl=' + reply, function(data) {
296 if (!editor) $("#profile-jot-text").val("");
297 initEditor(function(){
299 $('#profile-rotator').hide();
305 function itemTag(id) {
306 reply = prompt("$term");
307 if(reply && reply.length) {
308 reply = reply.replace('#','');
312 $('body').css('cursor', 'wait');
314 $.get('tagger/' + id + '?term=' + reply);
315 if(timer) clearTimeout(timer);
316 timer = setTimeout(NavUpdate,3000);
322 function itemFiler(id) {
324 var bordercolor = $("input").css("border-color");
326 $.get('filer/', function(data){
328 $("#id_term").keypress(function(){
329 $(this).css("border-color",bordercolor);
331 $("#select_term").change(function(){
332 $("#id_term").css("border-color",bordercolor);
335 $("#filer_save").click(function(e){
337 reply = $("#id_term").val();
338 if(reply && reply.length) {
340 $('body').css('cursor', 'wait');
341 $.get('filer/' + id + '?term=' + reply, NavUpdate);
342 // if(timer) clearTimeout(timer);
343 // timer = setTimeout(NavUpdate,3000);
347 $("#id_term").css("border-color","#FF0000");
357 function jotClearLocation() {
358 $('#jot-coord').val('');
359 $('#profile-nolocation-wrapper').hide();
362 function addeditortext(data) {
363 if(plaintext == 'none') {
364 var currentText = $("#profile-jot-text").val();
365 $("#profile-jot-text").val(currentText + data);
368 tinyMCE.execCommand('mceInsertRawHTML',false,data);