3 <script language="javascript" type="text/javascript">
7 var plaintext = '{{$editselect}}';
9 function initEditor(cb){
11 $("#profile-jot-text-loading").show();
12 if(plaintext == 'none') {
13 $("#profile-jot-text-loading").hide();
14 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
15 $("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
17 $("a#jot-perms-icon").colorbox({
19 'transition' : 'elastic'
21 $(".jothidden").show();
22 if (typeof cb!="undefined") cb();
27 mode : "specific_textareas",
28 editor_selector: {{$editselect}},
29 auto_focus: "profile-jot-text",
30 plugins : "bbcode,paste,autoresize, inlinepopups",
31 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
32 theme_advanced_buttons2 : "",
33 theme_advanced_buttons3 : "",
34 theme_advanced_toolbar_location : "top",
35 theme_advanced_toolbar_align : "center",
36 theme_advanced_blockformats : "blockquote,code",
37 theme_advanced_resizing : true,
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 : 'div',
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();
110 $("a#jot-perms-icon").colorbox({
112 'transition' : 'elastic'
115 if (typeof cb!="undefined") cb();
119 function enableOnUser(){
126 <script type="text/javascript" src="{{$baseurl}}/js/ajaxupload.js" ></script>
128 var ispublic = '{{$ispublic}}';
130 $(document).ready(function() {
132 /* enable tinymce on focus and click */
133 $("#profile-jot-text").focus(enableOnUser);
134 $("#profile-jot-text").click(enableOnUser);
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() {
163 if(confirm('{{$delitems}}')) {
166 $("#item-delete-selected").hide();
167 $('#item-delete-selected-rotator').show();
169 $('.item-select').each( function() {
170 if($(this).is(':checked')) {
171 if(checkedstr.length != 0) {
172 checkedstr = checkedstr + ',' + $(this).val();
175 checkedstr = $(this).val();
179 $.post('item', { dropitems: checkedstr }, function(data) {
180 window.location.reload();
185 function jotGetLink() {
186 reply = prompt("{{$linkurl}}");
187 if(reply && reply.length) {
188 reply = bin2hex(reply);
189 $('#profile-rotator').show();
190 $.get('parse_url?binurl=' + reply, function(data) {
192 $('#profile-rotator').hide();
197 function jotVideoURL() {
198 reply = prompt("{{$vidurl}}");
199 if(reply && reply.length) {
200 addeditortext('[video]' + reply + '[/video]');
204 function jotAudioURL() {
205 reply = prompt("{{$audurl}}");
206 if(reply && reply.length) {
207 addeditortext('[audio]' + reply + '[/audio]');
212 function jotGetLocation() {
213 reply = prompt("{{$whereareu}}", $('#jot-location').val());
214 if(reply && reply.length) {
215 $('#jot-location').val(reply);
219 function jotShare(id) {
220 if ($('#jot-popup').length != 0) $('#jot-popup').show();
222 $('#like-rotator-' + id).show();
223 $.get('share/' + id, function(data) {
224 if (!editor) $("#profile-jot-text").val("");
225 initEditor(function(){
227 $('#like-rotator-' + id).hide();
228 $(window).scrollTop(0);
234 function linkdropper(event) {
235 var linkFound = event.dataTransfer.types.contains("text/uri-list");
237 event.preventDefault();
240 function linkdrop(event) {
241 var reply = event.dataTransfer.getData("text/uri-list");
242 event.target.textContent = reply;
243 event.preventDefault();
244 if(reply && reply.length) {
245 reply = bin2hex(reply);
246 $('#profile-rotator').show();
247 $.get('parse_url?binurl=' + reply, function(data) {
248 if (!editor) $("#profile-jot-text").val("");
249 initEditor(function(){
251 $('#profile-rotator').hide();
257 function itemTag(id) {
258 reply = prompt("{{$term}}");
259 if(reply && reply.length) {
260 reply = reply.replace('#','');
264 $('body').css('cursor', 'wait');
266 $.get('tagger/' + id + '?term=' + reply);
267 if(timer) clearTimeout(timer);
268 timer = setTimeout(NavUpdate,3000);
274 function itemFiler(id) {
276 var bordercolor = $("input").css("border-color");
278 $.get('filer/', function(data){
279 $.colorbox({html:data});
280 $("#id_term").keypress(function(){
281 $(this).css("border-color",bordercolor);
283 $("#select_term").change(function(){
284 $("#id_term").css("border-color",bordercolor);
287 $("#filer_save").click(function(e){
289 reply = $("#id_term").val();
290 if(reply && reply.length) {
292 $('body').css('cursor', 'wait');
293 $.get('filer/' + id + '?term=' + reply, NavUpdate);
294 // if(timer) clearTimeout(timer);
295 // timer = setTimeout(NavUpdate,3000);
299 $("#id_term").css("border-color","#FF0000");
307 function jotClearLocation() {
308 $('#jot-coord').val('');
309 $('#profile-nolocation-wrapper').hide();
312 function addeditortext(data) {
313 if(plaintext == 'none') {
314 var currentText = $("#profile-jot-text").val();
315 $("#profile-jot-text").val(currentText + data);
318 tinyMCE.execCommand('mceInsertRawHTML',false,data);