1 <script type="text/javascript">
4 var plaintext = '$editselect';
6 function initEditor(cb) {
8 $("#profile-jot-text-loading").show();
9 if(plaintext == 'none') {
10 $("#profile-jot-text-loading").hide();
11 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
12 $("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
14 $("a#jot-perms-icon").fancybox({
15 'transitionIn' : 'elastic',
16 'transitionOut' : 'elastic'
18 $(".jothidden").show();
19 if (typeof cb!="undefined") cb();
24 mode : "specific_textareas",
25 editor_selector: $editselect,
26 auto_focus: "profile-jot-text",
27 plugins : "bbcode,paste,fullscreen,autoresize,inlinepopups",
28 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen",
29 theme_advanced_buttons2 : "",
30 theme_advanced_buttons3 : "",
31 theme_advanced_toolbar_location : "top",
32 theme_advanced_toolbar_align : "center",
33 theme_advanced_blockformats : "blockquote,code",
34 gecko_spellcheck : true,
35 paste_text_sticky : true,
36 entity_encoding : "raw",
37 add_unload_trigger : false,
38 remove_linebreaks : false,
39 force_p_newlines : false,
40 force_br_newlines : true,
41 forced_root_block : '',
43 content_css: "$baseurl/view/custom_tinymce.css",
44 theme_advanced_path : false,
45 file_browser_callback : "fcFileBrowser",
46 setup : function(ed) {
48 ed.onKeyDown.add(function(ed,e) {
53 ed.onKeyUp.add(function(ed, e) {
54 var txt = tinyMCE.activeEditor.getContent();
55 match = txt.match(/@([^ \n]+)$/);
58 cPopup = new ACPopup(this,baseurl+"/acl");
60 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
61 if(! cPopup.ready) cPopup = null;
64 if(cPopup !== null) { cPopup.close(); cPopup = null; }
68 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
69 $('#profile-jot-desc').html(ispublic);
72 $('#profile-jot-desc').html(' ');
78 $('#character-counter').removeClass('red');
79 $('#character-counter').removeClass('orange');
80 $('#character-counter').addClass('grey');
82 if((textlen > 140) && (textlen <= 420)) {
83 $('#character-counter').removeClass('grey');
84 $('#character-counter').removeClass('red');
85 $('#character-counter').addClass('orange');
88 $('#character-counter').removeClass('grey');
89 $('#character-counter').removeClass('orange');
90 $('#character-counter').addClass('red');
92 $('#character-counter').text(textlen);
95 ed.onInit.add(function(ed) {
96 ed.pasteAsPlainText = true;
97 $("#profile-jot-text-loading").hide();
98 $(".jothidden").show();
99 if (typeof cb!="undefined") cb();
106 $("a#jot-perms-icon").fancybox({
107 'transitionIn' : 'elastic',
108 'transitionOut' : 'elastic'
111 if (typeof cb!="undefined") cb();
115 function enableOnUser(){
122 <script type="text/javascript" src="$baseurl/js/ajaxupload.js"></script>
123 <script type="text/javascript">
124 var ispublic = '$ispublic';
125 var addtitle = '$addtitle';
127 $(document).ready(function() {
129 /* enable tinymce on focus and click */
130 $("#profile-jot-text").focus(enableOnUser);
131 $("#profile-jot-text").click(enableOnUser);
132 /* enable character counter */
133 $("#profile-jot-text").focus(charCounter);
134 $("#profile-jot-text").click(charCounter);
136 var uploader = new window.AjaxUpload(
138 { action: 'wall_upload/$nickname',
140 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
141 onComplete: function(file,response) {
142 addeditortext(response);
143 $('#profile-rotator').hide();
147 var file_uploader = new window.AjaxUpload(
149 { action: 'wall_attach/$nickname',
151 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
152 onComplete: function(file,response) {
153 addeditortext(response);
154 $('#profile-rotator').hide();
162 function deleteCheckedItems() {
165 $('.item-select').each( function() {
166 if($(this).is(':checked')) {
167 if(checkedstr.length != 0) {
168 checkedstr = checkedstr + ',' + $(this).val();
171 checkedstr = $(this).val();
175 $.post('item', { dropitems: checkedstr }, function(data) {
176 window.location.reload();
180 function jotGetLink() {
181 reply = prompt("$linkurl");
182 if(reply && reply.length) {
183 reply = bin2hex(reply);
184 $('#profile-rotator').show();
185 $.get('parse_url?binurl=' + reply, function(data) {
187 $('#profile-rotator').hide();
192 function jotVideoURL() {
193 reply = prompt("$vidurl");
194 if(reply && reply.length) {
195 addeditortext('[video]' + reply + '[/video]');
199 function jotAudioURL() {
200 reply = prompt("$audurl");
201 if(reply && reply.length) {
202 addeditortext('[audio]' + reply + '[/audio]');
207 function jotGetLocation() {
208 reply = prompt("$whereareu", $('#jot-location').val());
209 if(reply && reply.length) {
210 $('#jot-location').val(reply);
214 function jotShare(id) {
215 if ($('#jot-popup').length != 0) $('#jot-popup').show();
217 $('#like-rotator-' + id).show();
218 $.get('share/' + id, function(data) {
219 if (!editor) $("#profile-jot-text").val("");
220 initEditor(function(){
222 $('#like-rotator-' + id).hide();
223 $(window).scrollTop(0);
229 function linkdropper(event) {
230 var linkFound = event.dataTransfer.types.contains("text/uri-list");
232 event.preventDefault();
235 function linkdrop(event) {
236 var reply = event.dataTransfer.getData("text/uri-list");
237 event.target.textContent = reply;
238 event.preventDefault();
239 if(reply && reply.length) {
240 reply = bin2hex(reply);
241 $('#profile-rotator').show();
242 $.get('parse_url?binurl=' + reply, function(data) {
243 if (!editor) $("#profile-jot-text").val("");
244 initEditor(function(){
246 $('#profile-rotator').hide();
252 function itemTag(id) {
253 reply = prompt("$term");
254 if(reply && reply.length) {
255 reply = reply.replace('#','');
259 $('body').css('cursor', 'wait');
261 $.get('tagger/' + id + '?term=' + reply);
262 if(timer) clearTimeout(timer);
263 timer = setTimeout(NavUpdate,3000);
269 function itemFiler(id) {
271 var bordercolor = $("input").css("border-color");
273 $.get('filer/', function(data){
275 $("#id_term").keypress(function(){
276 $(this).css("border-color",bordercolor);
278 $("#select_term").change(function(){
279 $("#id_term").css("border-color",bordercolor);
282 $("#filer_save").click(function(e){
284 reply = $("#id_term").val();
285 if(reply && reply.length) {
287 $('body').css('cursor', 'wait');
288 $.get('filer/' + id + '?term=' + reply);
289 if(timer) clearTimeout(timer);
290 timer = setTimeout(NavUpdate,3000);
294 $("#id_term").css("border-color","#FF0000");
302 function jotClearLocation() {
303 $('#jot-coord').val('');
304 $('#profile-nolocation-wrapper').hide();
307 function addeditortext(data) {
308 if(plaintext == 'none') {
309 var currentText = $("#profile-jot-text").val();
310 $("#profile-jot-text").val(currentText + data);
313 tinyMCE.execCommand('mceInsertRawHTML',false,data);
318 function charCounter() {
319 // character count part deux
320 //$(this).val().length is not a function Line 282(3)
321 $('#profile-jot-text').keyup(function() {
326 $('#character-counter').removeClass('jothidden');
328 textLen = $(this).val().length;
329 if(textLen <= maxLen1) {
330 $('#character-counter').removeClass('red');
331 $('#character-counter').removeClass('orange');
332 $('#character-counter').addClass('grey');
334 if((textLen > maxLen1) && (textlen <= maxLen2)) {
335 $('#character-counter').removeClass('grey');
336 $('#character-counter').removeClass('red');
337 $('#character-counter').addClass('orange');
339 if(textLen > maxLen2) {
340 $('#character-counter').removeClass('grey');
341 $('#character-counter').removeClass('orange');
342 $('#character-counter').addClass('red');
344 $('#character-counter').text( textLen );
346 $('#profile-jot-text').keyup();