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,contextmenu,style",
28 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen,charmap",
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();
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();
159 function deleteCheckedItems() {
162 $('.item-select').each( function() {
163 if($(this).is(':checked')) {
164 if(checkedstr.length != 0) {
165 checkedstr = checkedstr + ',' + $(this).val();
168 checkedstr = $(this).val();
172 $.post('item', { dropitems: checkedstr }, function(data) {
173 window.location.reload();
177 function jotGetLink() {
178 reply = prompt("{{$linkurl}}");
179 if(reply && reply.length) {
180 reply = bin2hex(reply);
181 $('#profile-rotator').show();
182 $.get('parse_url?binurl=' + reply, function(data) {
184 $('#profile-rotator').hide();
189 function jotVideoURL() {
190 reply = prompt("{{$vidurl}}");
191 if(reply && reply.length) {
192 addeditortext('[video]' + reply + '[/video]');
196 function jotAudioURL() {
197 reply = prompt("{{$audurl}}");
198 if(reply && reply.length) {
199 addeditortext('[audio]' + reply + '[/audio]');
204 function jotGetLocation() {
205 reply = prompt("{{$whereareu}}", $('#jot-location').val());
206 if(reply && reply.length) {
207 $('#jot-location').val(reply);
211 function jotShare(id) {
212 if ($('#jot-popup').length != 0) $('#jot-popup').show();
214 $('#like-rotator-' + id).show();
215 $.get('share/' + id, function(data) {
216 if (!editor) $("#profile-jot-text").val("");
217 initEditor(function(){
219 $('#like-rotator-' + id).hide();
220 $(window).scrollTop(0);
226 function linkdropper(event) {
227 var linkFound = event.dataTransfer.types.contains("text/uri-list");
229 event.preventDefault();
232 function linkdrop(event) {
233 var reply = event.dataTransfer.getData("text/uri-list");
234 event.target.textContent = reply;
235 event.preventDefault();
236 if(reply && reply.length) {
237 reply = bin2hex(reply);
238 $('#profile-rotator').show();
239 $.get('parse_url?binurl=' + reply, function(data) {
240 if (!editor) $("#profile-jot-text").val("");
241 initEditor(function(){
243 $('#profile-rotator').hide();
249 function itemTag(id) {
250 reply = prompt("{{$term}}");
251 if(reply && reply.length) {
252 reply = reply.replace('#','');
256 $('body').css('cursor', 'wait');
258 $.get('tagger/' + id + '?term=' + reply);
259 if(timer) clearTimeout(timer);
260 timer = setTimeout(NavUpdate,3000);
266 function itemFiler(id) {
268 var bordercolor = $("input").css("border-color");
270 $.get('filer/', function(data){
272 $("#id_term").keypress(function(){
273 $(this).css("border-color",bordercolor);
275 $("#select_term").change(function(){
276 $("#id_term").css("border-color",bordercolor);
279 $("#filer_save").click(function(e){
281 reply = $("#id_term").val();
282 if(reply && reply.length) {
284 $('body').css('cursor', 'wait');
285 $.get('filer/' + id + '?term=' + reply);
286 if(timer) clearTimeout(timer);
287 timer = setTimeout(NavUpdate,3000);
291 $("#id_term").css("border-color","#FF0000");
299 function jotClearLocation() {
300 $('#jot-coord').val('');
301 $('#profile-nolocation-wrapper').hide();
304 function addeditortext(data) {
305 if(plaintext == 'none') {
306 var currentText = $("#profile-jot-text").val();
307 $("#profile-jot-text").val(currentText + data);
310 tinyMCE.execCommand('mceInsertRawHTML',false,data);
315 function charCounter() {
316 // character count part deux
317 //$(this).val().length is not a function Line 282(3)
318 $('#profile-jot-text').keyup(function() {
323 $('#character-counter').removeClass('jothidden');
325 textLen = $(this).val().length;
326 if(textLen <= maxLen1) {
327 $('#character-counter').removeClass('red');
328 $('#character-counter').removeClass('orange');
329 $('#character-counter').addClass('grey');
331 if((textLen > maxLen1) && (textlen <= maxLen2)) {
332 $('#character-counter').removeClass('grey');
333 $('#character-counter').removeClass('red');
334 $('#character-counter').addClass('orange');
336 if(textLen > maxLen2) {
337 $('#character-counter').removeClass('grey');
338 $('#character-counter').removeClass('orange');
339 $('#character-counter').addClass('red');
341 $('#character-counter').text( textLen );
343 $('#profile-jot-text').keyup();