2 * AUTOMATICALLY GENERATED TEMPLATE
3 * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
5 *}}<script type="text/javascript">
8 var plaintext = '{{$editselect}}';
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' });
16 $("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
18 $("a#jot-perms-icon").fancybox({
19 'transitionIn' : 'elastic',
20 'transitionOut' : 'elastic'
22 $(".jothidden").show();
23 if (typeof cb!="undefined") cb();
28 mode : "specific_textareas",
29 editor_selector: {{$editselect}},
30 auto_focus: "profile-jot-text",
31 plugins : "bbcode,paste,fullscreen,autoresize,inlinepopups,contextmenu,style",
32 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen,charmap",
33 theme_advanced_buttons2 : "",
34 theme_advanced_buttons3 : "",
35 theme_advanced_toolbar_location : "top",
36 theme_advanced_toolbar_align : "center",
37 theme_advanced_blockformats : "blockquote,code",
38 gecko_spellcheck : true,
39 paste_text_sticky : true,
40 entity_encoding : "raw",
41 add_unload_trigger : false,
42 remove_linebreaks : false,
43 force_p_newlines : false,
44 force_br_newlines : true,
45 forced_root_block : '',
47 content_css: "{{$baseurl}}/view/custom_tinymce.css",
48 theme_advanced_path : false,
49 file_browser_callback : "fcFileBrowser",
50 setup : function(ed) {
52 ed.onKeyDown.add(function(ed,e) {
57 ed.onKeyUp.add(function(ed, e) {
58 var txt = tinyMCE.activeEditor.getContent();
59 match = txt.match(/@([^ \n]+)$/);
62 cPopup = new ACPopup(this,baseurl+"/acl");
64 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
65 if(! cPopup.ready) cPopup = null;
68 if(cPopup !== null) { cPopup.close(); cPopup = null; }
72 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
73 $('#profile-jot-desc').html(ispublic);
76 $('#profile-jot-desc').html(' ');
82 $('#character-counter').removeClass('red');
83 $('#character-counter').removeClass('orange');
84 $('#character-counter').addClass('grey');
86 if((textlen > 140) && (textlen <= 420)) {
87 $('#character-counter').removeClass('grey');
88 $('#character-counter').removeClass('red');
89 $('#character-counter').addClass('orange');
92 $('#character-counter').removeClass('grey');
93 $('#character-counter').removeClass('orange');
94 $('#character-counter').addClass('red');
96 $('#character-counter').text(textlen);
99 ed.onInit.add(function(ed) {
100 ed.pasteAsPlainText = true;
101 $("#profile-jot-text-loading").hide();
102 $(".jothidden").show();
103 if (typeof cb!="undefined") cb();
109 $("a#jot-perms-icon").fancybox({
110 'transitionIn' : 'elastic',
111 'transitionOut' : 'elastic'
114 if (typeof cb!="undefined") cb();
118 function enableOnUser(){
125 <script type="text/javascript" src="{{$baseurl}}/js/ajaxupload.js"></script>
126 <script type="text/javascript">
127 var ispublic = '{{$ispublic}}';
128 var addtitle = '{{$addtitle}}';
130 $(document).ready(function() {
132 /* enable tinymce on focus and click */
133 $("#profile-jot-text").focus(enableOnUser);
134 $("#profile-jot-text").click(enableOnUser);
135 /* enable character counter */
136 $("#profile-jot-text").focus(charCounter);
137 $("#profile-jot-text").click(charCounter);
139 var uploader = new window.AjaxUpload(
141 { action: 'wall_upload/{{$nickname}}',
143 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
144 onComplete: function(file,response) {
145 addeditortext(response);
146 $('#profile-rotator').hide();
150 var file_uploader = new window.AjaxUpload(
152 { action: 'wall_attach/{{$nickname}}',
154 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
155 onComplete: function(file,response) {
156 addeditortext(response);
157 $('#profile-rotator').hide();
163 function deleteCheckedItems() {
166 $('.item-select').each( function() {
167 if($(this).is(':checked')) {
168 if(checkedstr.length != 0) {
169 checkedstr = checkedstr + ',' + $(this).val();
172 checkedstr = $(this).val();
176 $.post('item', { dropitems: checkedstr }, function(data) {
177 window.location.reload();
181 function jotGetLink() {
182 reply = prompt("{{$linkurl}}");
183 if(reply && reply.length) {
184 reply = bin2hex(reply);
185 $('#profile-rotator').show();
186 $.get('parse_url?binurl=' + reply, function(data) {
188 $('#profile-rotator').hide();
193 function jotVideoURL() {
194 reply = prompt("{{$vidurl}}");
195 if(reply && reply.length) {
196 addeditortext('[video]' + reply + '[/video]');
200 function jotAudioURL() {
201 reply = prompt("{{$audurl}}");
202 if(reply && reply.length) {
203 addeditortext('[audio]' + reply + '[/audio]');
208 function jotGetLocation() {
209 reply = prompt("{{$whereareu}}", $('#jot-location').val());
210 if(reply && reply.length) {
211 $('#jot-location').val(reply);
215 function jotShare(id) {
216 if ($('#jot-popup').length != 0) $('#jot-popup').show();
218 $('#like-rotator-' + id).show();
219 $.get('share/' + id, function(data) {
220 if (!editor) $("#profile-jot-text").val("");
221 initEditor(function(){
223 $('#like-rotator-' + id).hide();
224 $(window).scrollTop(0);
230 function linkdropper(event) {
231 var linkFound = event.dataTransfer.types.contains("text/uri-list");
233 event.preventDefault();
236 function linkdrop(event) {
237 var reply = event.dataTransfer.getData("text/uri-list");
238 event.target.textContent = reply;
239 event.preventDefault();
240 if(reply && reply.length) {
241 reply = bin2hex(reply);
242 $('#profile-rotator').show();
243 $.get('parse_url?binurl=' + reply, function(data) {
244 if (!editor) $("#profile-jot-text").val("");
245 initEditor(function(){
247 $('#profile-rotator').hide();
253 function itemTag(id) {
254 reply = prompt("{{$term}}");
255 if(reply && reply.length) {
256 reply = reply.replace('#','');
260 $('body').css('cursor', 'wait');
262 $.get('tagger/' + id + '?term=' + reply);
263 if(timer) clearTimeout(timer);
264 timer = setTimeout(NavUpdate,3000);
270 function itemFiler(id) {
272 var bordercolor = $("input").css("border-color");
274 $.get('filer/', function(data){
276 $("#id_term").keypress(function(){
277 $(this).css("border-color",bordercolor);
279 $("#select_term").change(function(){
280 $("#id_term").css("border-color",bordercolor);
283 $("#filer_save").click(function(e){
285 reply = $("#id_term").val();
286 if(reply && reply.length) {
288 $('body').css('cursor', 'wait');
289 $.get('filer/' + id + '?term=' + reply);
290 if(timer) clearTimeout(timer);
291 timer = setTimeout(NavUpdate,3000);
295 $("#id_term").css("border-color","#FF0000");
303 function jotClearLocation() {
304 $('#jot-coord').val('');
305 $('#profile-nolocation-wrapper').hide();
308 function addeditortext(data) {
309 if(plaintext == 'none') {
310 var currentText = $("#profile-jot-text").val();
311 $("#profile-jot-text").val(currentText + data);
314 tinyMCE.execCommand('mceInsertRawHTML',false,data);
319 function charCounter() {
320 // character count part deux
321 //$(this).val().length is not a function Line 282(3)
322 $('#profile-jot-text').keyup(function() {
327 $('#character-counter').removeClass('jothidden');
329 textLen = $(this).val().length;
330 if(textLen <= maxLen1) {
331 $('#character-counter').removeClass('red');
332 $('#character-counter').removeClass('orange');
333 $('#character-counter').addClass('grey');
335 if((textLen > maxLen1) && (textlen <= maxLen2)) {
336 $('#character-counter').removeClass('grey');
337 $('#character-counter').removeClass('red');
338 $('#character-counter').addClass('orange');
340 if(textLen > maxLen2) {
341 $('#character-counter').removeClass('grey');
342 $('#character-counter').removeClass('orange');
343 $('#character-counter').addClass('red');
345 $('#character-counter').text( textLen );
347 $('#profile-jot-text').keyup();