2 * AUTOMATICALLY GENERATED TEMPLATE
3 * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
6 <script type="text/javascript">
9 var plaintext = '{{$editselect}}';
11 function initEditor(cb) {
13 $("#profile-jot-text-loading").show();
14 if(plaintext == 'none') {
15 $("#profile-jot-text-loading").hide();
16 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
17 $("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
19 $("a#jot-perms-icon").fancybox({
20 'transitionIn' : 'elastic',
21 'transitionOut' : 'elastic'
23 $(".jothidden").show();
24 if (typeof cb!="undefined") cb();
29 mode : "specific_textareas",
30 editor_selector: {{$editselect}},
31 auto_focus: "profile-jot-text",
32 plugins : "bbcode,paste,fullscreen,autoresize,inlinepopups,contextmenu,style",
33 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen,charmap",
34 theme_advanced_buttons2 : "",
35 theme_advanced_buttons3 : "",
36 theme_advanced_toolbar_location : "top",
37 theme_advanced_toolbar_align : "center",
38 theme_advanced_blockformats : "blockquote,code",
39 gecko_spellcheck : true,
40 paste_text_sticky : true,
41 entity_encoding : "raw",
42 add_unload_trigger : false,
43 remove_linebreaks : false,
44 force_p_newlines : false,
45 force_br_newlines : true,
46 forced_root_block : '',
48 content_css: "{{$baseurl}}/view/custom_tinymce.css",
49 theme_advanced_path : false,
50 file_browser_callback : "fcFileBrowser",
51 setup : function(ed) {
53 ed.onKeyDown.add(function(ed,e) {
58 ed.onKeyUp.add(function(ed, e) {
59 var txt = tinyMCE.activeEditor.getContent();
60 match = txt.match(/@([^ \n]+)$/);
63 cPopup = new ACPopup(this,baseurl+"/acl");
65 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
66 if(! cPopup.ready) cPopup = null;
69 if(cPopup !== null) { cPopup.close(); cPopup = null; }
73 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
74 $('#profile-jot-desc').html(ispublic);
77 $('#profile-jot-desc').html(' ');
83 $('#character-counter').removeClass('red');
84 $('#character-counter').removeClass('orange');
85 $('#character-counter').addClass('grey');
87 if((textlen > 140) && (textlen <= 420)) {
88 $('#character-counter').removeClass('grey');
89 $('#character-counter').removeClass('red');
90 $('#character-counter').addClass('orange');
93 $('#character-counter').removeClass('grey');
94 $('#character-counter').removeClass('orange');
95 $('#character-counter').addClass('red');
97 $('#character-counter').text(textlen);
100 ed.onInit.add(function(ed) {
101 ed.pasteAsPlainText = true;
102 $("#profile-jot-text-loading").hide();
103 $(".jothidden").show();
104 if (typeof cb!="undefined") cb();
110 $("a#jot-perms-icon").fancybox({
111 'transitionIn' : 'elastic',
112 'transitionOut' : 'elastic'
115 if (typeof cb!="undefined") cb();
119 function enableOnUser(){
126 <script type="text/javascript" src="{{$baseurl}}/js/ajaxupload.js"></script>
127 <script type="text/javascript">
128 var ispublic = '{{$ispublic}}';
129 var addtitle = '{{$addtitle}}';
131 $(document).ready(function() {
133 /* enable tinymce on focus and click */
134 $("#profile-jot-text").focus(enableOnUser);
135 $("#profile-jot-text").click(enableOnUser);
136 /* enable character counter */
137 $("#profile-jot-text").focus(charCounter);
138 $("#profile-jot-text").click(charCounter);
140 var uploader = new window.AjaxUpload(
142 { action: 'wall_upload/{{$nickname}}',
144 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
145 onComplete: function(file,response) {
146 addeditortext(response);
147 $('#profile-rotator').hide();
151 var file_uploader = new window.AjaxUpload(
153 { action: 'wall_attach/{{$nickname}}',
155 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
156 onComplete: function(file,response) {
157 addeditortext(response);
158 $('#profile-rotator').hide();
164 function deleteCheckedItems() {
167 $('.item-select').each( function() {
168 if($(this).is(':checked')) {
169 if(checkedstr.length != 0) {
170 checkedstr = checkedstr + ',' + $(this).val();
173 checkedstr = $(this).val();
177 $.post('item', { dropitems: checkedstr }, function(data) {
178 window.location.reload();
182 function jotGetLink() {
183 reply = prompt("{{$linkurl}}");
184 if(reply && reply.length) {
185 reply = bin2hex(reply);
186 $('#profile-rotator').show();
187 $.get('parse_url?binurl=' + reply, function(data) {
189 $('#profile-rotator').hide();
194 function jotVideoURL() {
195 reply = prompt("{{$vidurl}}");
196 if(reply && reply.length) {
197 addeditortext('[video]' + reply + '[/video]');
201 function jotAudioURL() {
202 reply = prompt("{{$audurl}}");
203 if(reply && reply.length) {
204 addeditortext('[audio]' + reply + '[/audio]');
209 function jotGetLocation() {
210 reply = prompt("{{$whereareu}}", $('#jot-location').val());
211 if(reply && reply.length) {
212 $('#jot-location').val(reply);
216 function jotShare(id) {
217 if ($('#jot-popup').length != 0) $('#jot-popup').show();
219 $('#like-rotator-' + id).show();
220 $.get('share/' + id, function(data) {
221 if (!editor) $("#profile-jot-text").val("");
222 initEditor(function(){
224 $('#like-rotator-' + id).hide();
225 $(window).scrollTop(0);
231 function linkdropper(event) {
232 var linkFound = event.dataTransfer.types.contains("text/uri-list");
234 event.preventDefault();
237 function linkdrop(event) {
238 var reply = event.dataTransfer.getData("text/uri-list");
239 event.target.textContent = reply;
240 event.preventDefault();
241 if(reply && reply.length) {
242 reply = bin2hex(reply);
243 $('#profile-rotator').show();
244 $.get('parse_url?binurl=' + reply, function(data) {
245 if (!editor) $("#profile-jot-text").val("");
246 initEditor(function(){
248 $('#profile-rotator').hide();
254 function itemTag(id) {
255 reply = prompt("{{$term}}");
256 if(reply && reply.length) {
257 reply = reply.replace('#','');
261 $('body').css('cursor', 'wait');
263 $.get('tagger/' + id + '?term=' + reply);
264 if(timer) clearTimeout(timer);
265 timer = setTimeout(NavUpdate,3000);
271 function itemFiler(id) {
273 var bordercolor = $("input").css("border-color");
275 $.get('filer/', function(data){
277 $("#id_term").keypress(function(){
278 $(this).css("border-color",bordercolor);
280 $("#select_term").change(function(){
281 $("#id_term").css("border-color",bordercolor);
284 $("#filer_save").click(function(e){
286 reply = $("#id_term").val();
287 if(reply && reply.length) {
289 $('body').css('cursor', 'wait');
290 $.get('filer/' + id + '?term=' + reply);
291 if(timer) clearTimeout(timer);
292 timer = setTimeout(NavUpdate,3000);
296 $("#id_term").css("border-color","#FF0000");
304 function jotClearLocation() {
305 $('#jot-coord').val('');
306 $('#profile-nolocation-wrapper').hide();
309 function addeditortext(data) {
310 if(plaintext == 'none') {
311 var currentText = $("#profile-jot-text").val();
312 $("#profile-jot-text").val(currentText + data);
315 tinyMCE.execCommand('mceInsertRawHTML',false,data);
320 function charCounter() {
321 // character count part deux
322 //$(this).val().length is not a function Line 282(3)
323 $('#profile-jot-text').keyup(function() {
328 $('#character-counter').removeClass('jothidden');
330 textLen = $(this).val().length;
331 if(textLen <= maxLen1) {
332 $('#character-counter').removeClass('red');
333 $('#character-counter').removeClass('orange');
334 $('#character-counter').addClass('grey');
336 if((textLen > maxLen1) && (textlen <= maxLen2)) {
337 $('#character-counter').removeClass('grey');
338 $('#character-counter').removeClass('red');
339 $('#character-counter').addClass('orange');
341 if(textLen > maxLen2) {
342 $('#character-counter').removeClass('grey');
343 $('#character-counter').removeClass('orange');
344 $('#character-counter').addClass('red');
346 $('#character-counter').text( textLen );
348 $('#profile-jot-text').keyup();