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") cb();
27 mode : "specific_textareas",
28 editor_selector: $editselect,
29 auto_focus: "profile-jot-text",
30 plugins : "bbcode,paste,fullscreen,autoresize",
31 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen",
32 theme_advanced_buttons2 : "",
33 theme_advanced_buttons3 : "",
34 theme_advanced_toolbar_location : "top",
35 theme_advanced_toolbar_align : "center",
36 theme_advanced_blockformats : "blockquote,code",
37 paste_text_sticky : true,
38 entity_encoding : "raw",
39 add_unload_trigger : false,
40 remove_linebreaks : false,
41 force_p_newlines : false,
42 force_br_newlines : true,
43 forced_root_block : '',
45 content_css: "$baseurl/view/custom_tinymce.css",
46 theme_advanced_path : false,
47 setup : function(ed) {
49 ed.onKeyDown.add(function(ed,e) {
54 ed.onKeyUp.add(function(ed, e) {
55 var txt = tinyMCE.activeEditor.getContent();
56 match = txt.match(/@([^ \n]+)$/);
59 cPopup = new ACPopup(this,baseurl+"/acl");
61 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
62 if(! cPopup.ready) cPopup = null;
65 if(cPopup !== null) { cPopup.close(); cPopup = null; }
69 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
70 $('#profile-jot-desc').html(ispublic);
73 $('#profile-jot-desc').html(' ');
79 $('#character-counter').removeClass('red');
80 $('#character-counter').removeClass('orange');
81 $('#character-counter').addClass('grey');
83 if((textlen > 140) && (textlen <= 420)) {
84 $('#character-counter').removeClass('grey');
85 $('#character-counter').removeClass('red');
86 $('#character-counter').addClass('orange');
89 $('#character-counter').removeClass('grey');
90 $('#character-counter').removeClass('orange');
91 $('#character-counter').addClass('red');
93 $('#character-counter').text(textlen);
96 ed.onInit.add(function(ed) {
97 ed.pasteAsPlainText = true;
98 $("#profile-jot-text-loading").hide();
99 $(".jothidden").show();
100 if (typeof cb!="undefined") cb();
107 $("a#jot-perms-icon").fancybox({
108 'transitionIn' : 'elastic',
109 'transitionOut' : 'elastic'
112 if (typeof cb!="undefined") cb();
116 function charCounter() {
117 // character count part deux
118 $('#profile-jot-text').keyup(function(event) {
119 var textlen = $('#profile-jot-text').val().length();
123 $('#character-counter').removeClass('jothidden');
124 if(textlen <= maxLen1) {
125 $('#character-counter').removeClass('red');
126 $('#character-counter').removeClass('orange');
127 $('#character-counter').addClass('grey');
129 if((textlen > maxLen1) && (textlen <= maxLen2)) {
130 $('#character-counter').removeClass('grey');
131 $('#character-counter').removeClass('red');
132 $('#character-counter').addClass('orange');
134 if(textlen > maxLen2) {
135 $('#character-counter').removeClass('grey');
136 $('#character-counter').removeClass('orange');
137 $('#character-counter').addClass('red');
139 $('#character-counter').html($('#profile-jot-text').val().length);
143 function enableOnUser(){
150 <script type="text/javascript" src="$baseurl/js/ajaxupload.js" ></script>
152 var ispublic = '$ispublic';
153 var addtitle = '$addtitle';
155 $(document).ready(function() {
157 /* enable tinymce on focus and click */
158 $("#profile-jot-text").focus(enableOnUser);
159 $("#profile-jot-text").click(enableOnUser);
160 $("#profile-jot-text").focus(charCounter);
161 $("#profile-jot-text").click(charCounter);
163 var uploader = new window.AjaxUpload(
165 { action: 'wall_upload/$nickname',
167 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
168 onComplete: function(file,response) {
169 addeditortext(response);
170 $('#profile-rotator').hide();
174 var file_uploader = new window.AjaxUpload(
176 { action: 'wall_attach/$nickname',
178 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
179 onComplete: function(file,response) {
180 addeditortext(response);
181 $('#profile-rotator').hide();
189 function deleteCheckedItems() {
192 $('.item-select').each( function() {
193 if($(this).is(':checked')) {
194 if(checkedstr.length != 0) {
195 checkedstr = checkedstr + ',' + $(this).val();
198 checkedstr = $(this).val();
202 $.post('item', { dropitems: checkedstr }, function(data) {
203 window.location.reload();
207 function jotGetLink() {
208 reply = prompt("$linkurl");
209 if(reply && reply.length) {
210 reply = bin2hex(reply);
211 $('#profile-rotator').show();
212 $.get('parse_url?binurl=' + reply, function(data) {
214 $('#profile-rotator').hide();
219 function jotVideoURL() {
220 reply = prompt("$vidurl");
221 if(reply && reply.length) {
222 addeditortext('[video]' + reply + '[/video]');
226 function jotAudioURL() {
227 reply = prompt("$audurl");
228 if(reply && reply.length) {
229 addeditortext('[audio]' + reply + '[/audio]');
234 function jotGetLocation() {
235 reply = prompt("$whereareu", $('#jot-location').val());
236 if(reply && reply.length) {
237 $('#jot-location').val(reply);
241 function jotShare(id) {
242 if ($('#jot-popup').length != 0) $('#jot-popup').show();
244 $('#like-rotator-' + id).show();
245 $.get('share/' + id, function(data) {
246 if (!editor) $("#profile-jot-text").val("");
247 initEditor(function(){
249 $('#like-rotator-' + id).hide();
250 $(window).scrollTop(0);
256 function linkdropper(event) {
257 var linkFound = event.dataTransfer.types.contains("text/uri-list");
259 event.preventDefault();
262 function linkdrop(event) {
263 var reply = event.dataTransfer.getData("text/uri-list");
264 event.target.textContent = reply;
265 event.preventDefault();
266 if(reply && reply.length) {
267 reply = bin2hex(reply);
268 $('#profile-rotator').show();
269 $.get('parse_url?binurl=' + reply, function(data) {
270 if (!editor) $("#profile-jot-text").val("");
271 initEditor(function(){
273 $('#profile-rotator').hide();
279 function itemTag(id) {
280 reply = prompt("$term");
281 if(reply && reply.length) {
282 reply = reply.replace('#','');
286 $('body').css('cursor', 'wait');
288 $.get('tagger/' + id + '?term=' + reply);
289 if(timer) clearTimeout(timer);
290 timer = setTimeout(NavUpdate,3000);
296 function jotClearLocation() {
297 $('#jot-coord').val('');
298 $('#profile-nolocation-wrapper').hide();
301 function addeditortext(data) {
302 if(plaintext == 'none') {
303 var currentText = $("#profile-jot-text").val();
304 $("#profile-jot-text").val(currentText + data);
307 tinyMCE.execCommand('mceInsertRawHTML',false,data);