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",
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 setup : function(ed) {
47 ed.onKeyDown.add(function(ed,e) {
52 ed.onKeyUp.add(function(ed, e) {
53 var txt = tinyMCE.activeEditor.getContent();
54 match = txt.match(/@([^ \n]+)$/);
57 cPopup = new ACPopup(this,baseurl+"/acl");
59 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
60 if(! cPopup.ready) cPopup = null;
63 if(cPopup !== null) { cPopup.close(); cPopup = null; }
67 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
68 $('#profile-jot-desc').html(ispublic);
71 $('#profile-jot-desc').html(' ');
77 $('#character-counter').removeClass('red');
78 $('#character-counter').removeClass('orange');
79 $('#character-counter').addClass('grey');
81 if((textlen > 140) && (textlen <= 420)) {
82 $('#character-counter').removeClass('grey');
83 $('#character-counter').removeClass('red');
84 $('#character-counter').addClass('orange');
87 $('#character-counter').removeClass('grey');
88 $('#character-counter').removeClass('orange');
89 $('#character-counter').addClass('red');
91 $('#character-counter').text(textlen);
94 ed.onInit.add(function(ed) {
95 ed.pasteAsPlainText = true;
96 $("#profile-jot-text-loading").hide();
97 $(".jothidden").show();
98 if (typeof cb!="undefined") cb();
105 $("a#jot-perms-icon").fancybox({
106 'transitionIn' : 'elastic',
107 'transitionOut' : 'elastic'
110 if (typeof cb!="undefined") cb();
114 function enableOnUser(){
121 <script type="text/javascript" src="$baseurl/js/ajaxupload.js"></script>
122 <script type="text/javascript">
123 var ispublic = '$ispublic';
124 var addtitle = '$addtitle';
126 $(document).ready(function() {
128 /* enable tinymce on focus and click */
129 $("#profile-jot-text").focus(enableOnUser);
130 $("#profile-jot-text").click(enableOnUser);
131 /* enable character counter */
132 $("#profile-jot-text").focus(charCounter);
133 $("#profile-jot-text").click(charCounter);
135 var uploader = new window.AjaxUpload(
137 { action: 'wall_upload/$nickname',
139 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
140 onComplete: function(file,response) {
141 addeditortext(response);
142 $('#profile-rotator').hide();
146 var file_uploader = new window.AjaxUpload(
148 { action: 'wall_attach/$nickname',
150 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
151 onComplete: function(file,response) {
152 addeditortext(response);
153 $('#profile-rotator').hide();
161 function deleteCheckedItems() {
164 $('.item-select').each( function() {
165 if($(this).is(':checked')) {
166 if(checkedstr.length != 0) {
167 checkedstr = checkedstr + ',' + $(this).val();
170 checkedstr = $(this).val();
174 $.post('item', { dropitems: checkedstr }, function(data) {
175 window.location.reload();
179 function jotGetLink() {
180 reply = prompt("$linkurl");
181 if(reply && reply.length) {
182 reply = bin2hex(reply);
183 $('#profile-rotator').show();
184 $.get('parse_url?binurl=' + reply, function(data) {
186 $('#profile-rotator').hide();
191 function jotVideoURL() {
192 reply = prompt("$vidurl");
193 if(reply && reply.length) {
194 addeditortext('[video]' + reply + '[/video]');
198 function jotAudioURL() {
199 reply = prompt("$audurl");
200 if(reply && reply.length) {
201 addeditortext('[audio]' + reply + '[/audio]');
206 function jotGetLocation() {
207 reply = prompt("$whereareu", $('#jot-location').val());
208 if(reply && reply.length) {
209 $('#jot-location').val(reply);
213 function jotShare(id) {
214 if ($('#jot-popup').length != 0) $('#jot-popup').show();
216 $('#like-rotator-' + id).show();
217 $.get('share/' + id, function(data) {
218 if (!editor) $("#profile-jot-text").val("");
219 initEditor(function(){
221 $('#like-rotator-' + id).hide();
222 $(window).scrollTop(0);
228 function linkdropper(event) {
229 var linkFound = event.dataTransfer.types.contains("text/uri-list");
231 event.preventDefault();
234 function linkdrop(event) {
235 var reply = event.dataTransfer.getData("text/uri-list");
236 event.target.textContent = reply;
237 event.preventDefault();
238 if(reply && reply.length) {
239 reply = bin2hex(reply);
240 $('#profile-rotator').show();
241 $.get('parse_url?binurl=' + reply, function(data) {
242 if (!editor) $("#profile-jot-text").val("");
243 initEditor(function(){
245 $('#profile-rotator').hide();
251 function itemTag(id) {
252 reply = prompt("$term");
253 if(reply && reply.length) {
254 reply = reply.replace('#','');
258 $('body').css('cursor', 'wait');
260 $.get('tagger/' + id + '?term=' + reply);
261 if(timer) clearTimeout(timer);
262 timer = setTimeout(NavUpdate,3000);
268 function itemFiler(id) {
270 var bordercolor = $("input").css("border-color");
272 $.get('filer/', function(data){
274 $("#id_term").keypress(function(){
275 $(this).css("border-color",bordercolor);
277 $("#select_term").change(function(){
278 $("#id_term").css("border-color",bordercolor);
281 $("#filer_save").click(function(e){
283 reply = $("#id_term").val();
284 if(reply && reply.length) {
286 $('body').css('cursor', 'wait');
287 $.get('filer/' + id + '?term=' + reply);
288 if(timer) clearTimeout(timer);
289 timer = setTimeout(NavUpdate,3000);
293 $("#id_term").css("border-color","#FF0000");
301 function jotClearLocation() {
302 $('#jot-coord').val('');
303 $('#profile-nolocation-wrapper').hide();
306 function addeditortext(data) {
307 if(plaintext == 'none') {
308 var currentText = $("#profile-jot-text").val();
309 $("#profile-jot-text").val(currentText + data);
312 tinyMCE.execCommand('mceInsertRawHTML',false,data);
317 function charCounter() {
318 // character count part deux
319 //$(this).val().length is not a function Line 282(3)
320 $('#profile-jot-text').keyup(function() {
325 $('#character-counter').removeClass('jothidden');
327 textLen = $(this).val().length;
328 if(textLen <= maxLen1) {
329 $('#character-counter').removeClass('red');
330 $('#character-counter').removeClass('orange');
331 $('#character-counter').addClass('grey');
333 if((textLen > maxLen1) && (textlen <= maxLen2)) {
334 $('#character-counter').removeClass('grey');
335 $('#character-counter').removeClass('red');
336 $('#character-counter').addClass('orange');
338 if(textLen > maxLen2) {
339 $('#character-counter').removeClass('grey');
340 $('#character-counter').removeClass('orange');
341 $('#character-counter').addClass('red');
343 $('#character-counter').text( textLen );
345 $('#profile-jot-text').keyup();