2 <script language="javascript" type="text/javascript">
6 var plaintext = '$editselect';
7 // this is here because of the silly tinymce error. didn't help.
10 function initEditor(cb) {
12 $("#profile-jot-text-loading").show();
13 if(plaintext == 'none') {
14 $("#profile-jot-text-loading").hide();
15 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
17 $("a#jot-perms-icon").fancybox({
18 'transitionIn' : 'elastic',
19 'transitionOut' : 'elastic'
21 $(".jothidden").show();
22 if (typeof cb!="undefined") {
31 mode : "specific_textareas",
32 editor_selector: $editselect,
33 auto_focus: "profile-jot-text",
34 plugins : "bbcode,paste,fullscreen,autoresize",
35 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen",
36 theme_advanced_buttons2 : "",
37 theme_advanced_buttons3 : "",
38 theme_advanced_toolbar_location : "top",
39 theme_advanced_toolbar_align : "center",
40 theme_advanced_blockformats : "blockquote,code",
41 paste_text_sticky : true,
42 entity_encoding : "raw",
43 add_unload_trigger : false,
44 remove_linebreaks : false,
45 force_p_newlines : false,
46 force_br_newlines : true,
47 forced_root_block : '',
49 content_css: "$baseurl/view/custom_tinymce.css",
50 theme_advanced_path : false,
51 setup : function(ed) {
53 ed.onKeyDown.add(function(ed,e) {
59 ed.onKeyUp.add(function(ed, e) {
60 var txt = tinyMCE.activeEditor.getContent();
61 match = txt.match(/@([^ \n]+)$/);
64 cPopup = new ACPopup(this,baseurl+"/acl");
66 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
67 if(! cPopup.ready) { cPopup = null; }
70 if(cPopup !== null) { cPopup.close(); cPopup = null; }
74 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
75 $('#profile-jot-desc').html(ispublic);
78 $('#profile-jot-desc').html(' ');
84 $('#character-counter').removeClass('red');
85 $('#character-counter').removeClass('orange');
86 $('#character-counter').addClass('grey');
88 if((textlen > 140) && (textlen <= 420)) {
89 $('#character-counter').removeClass('grey');
90 $('#character-counter').removeClass('red');
91 $('#character-counter').addClass('orange');
94 $('#character-counter').removeClass('grey');
95 $('#character-counter').removeClass('orange');
96 $('#character-counter').addClass('red');
98 $('#character-counter').text(textlen);
101 ed.onInit.add(function(ed) {
102 ed.pasteAsPlainText = true;
103 $("#profile-jot-text-loading").hide();
104 $(".jothidden").show();
106 if (typeof cb!="undefined") { cb(); }
108 // character count part deux
111 var textlen = $('#profile-jot-text').val().length();
112 $('#character-counter').html(textlen);
114 $('#profile-jot-text').keyup(function() {
115 $('#character-counter').removeClass('jothidden');
117 $('#character-counter').removeClass('red');
118 $('#character-counter').removeClass('orange');
119 $('#character-counter').addClass('grey');
121 if((textlen > 140) && (textlen <= 420)) {
122 $('#character-counter').removeClass('grey');
123 $('#character-counter').removeClass('red');
124 $('#character-counter').addClass('orange');
127 $('#character-counter').removeClass('grey');
128 $('#character-counter').removeClass('orange');
129 $('#character-counter').addClass('red');
132 $('#character-counter').html($(this).val().length);
140 $("a#jot-perms-icon").fancybox({
141 'transitionIn' : 'elastic',
142 'transitionOut' : 'elastic'
145 if (typeof cb!="undefined") cb();
149 function enableOnUser(){
156 <script type="text/javascript" src="$baseurl/js/ajaxupload.js" ></script>
158 var ispublic = '$ispublic';
159 var addtitle = '$addtitle';
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();
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();
193 function deleteCheckedItems() {
196 $('.item-select').each( function() {
197 if($(this).is(':checked')) {
198 if(checkedstr.length != 0) {
199 checkedstr = checkedstr + ',' + $(this).val();
202 checkedstr = $(this).val();
206 $.post('item', { dropitems: checkedstr }, function(data) {
207 window.location.reload();
211 function jotGetLink() {
212 reply = prompt("$linkurl");
213 if(reply && reply.length) {
214 reply = bin2hex(reply);
215 $('#profile-rotator').show();
216 $.get('parse_url?binurl=' + reply, function(data) {
218 $('#profile-rotator').hide();
223 function jotVideoURL() {
224 reply = prompt("$vidurl");
225 if(reply && reply.length) {
226 addeditortext('[video]' + reply + '[/video]');
230 function jotAudioURL() {
231 reply = prompt("$audurl");
232 if(reply && reply.length) {
233 addeditortext('[audio]' + reply + '[/audio]');
238 function jotGetLocation() {
239 reply = prompt("$whereareu", $('#jot-location').val());
240 if(reply && reply.length) {
241 $('#jot-location').val(reply);
245 function jotShare(id) {
246 if ($('#jot-popup').length != 0) $('#jot-popup').show();
248 $('#like-rotator-' + id).show();
249 $.get('share/' + id, function(data) {
250 if (!editor) $("#profile-jot-text").val("");
251 initEditor(function(){
253 $('#like-rotator-' + id).hide();
254 $(window).scrollTop(0);
260 function linkdropper(event) {
261 var linkFound = event.dataTransfer.types.contains("text/uri-list");
263 event.preventDefault();
266 function linkdrop(event) {
267 var reply = event.dataTransfer.getData("text/uri-list");
268 event.target.textContent = reply;
269 event.preventDefault();
270 if(reply && reply.length) {
271 reply = bin2hex(reply);
272 $('#profile-rotator').show();
273 $.get('parse_url?binurl=' + reply, function(data) {
274 if (!editor) $("#profile-jot-text").val("");
275 initEditor(function(){
277 $('#profile-rotator').hide();
283 function itemTag(id) {
284 reply = prompt("$term");
285 if(reply && reply.length) {
286 reply = reply.replace('#','');
290 $('body').css('cursor', 'wait');
292 $.get('tagger/' + id + '?term=' + reply);
293 if(timer) clearTimeout(timer);
294 timer = setTimeout(NavUpdate,3000);
300 function jotClearLocation() {
301 $('#jot-coord').val('');
302 $('#profile-nolocation-wrapper').hide();
305 function addeditortext(data) {
306 if(plaintext == 'none') {
307 var currentText = $("#profile-jot-text").val();
308 $("#profile-jot-text").val(currentText + data);
311 tinyMCE.execCommand('mceInsertRawHTML',false,data);