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 gecko_spellcheck : true,
38 paste_text_sticky : true,
39 entity_encoding : "raw",
40 add_unload_trigger : false,
41 remove_linebreaks : false,
42 //force_p_newlines : false,
43 //force_br_newlines : true,
44 forced_root_block : 'div',
46 content_css: "{{$baseurl}}/view/custom_tinymce.css",
47 theme_advanced_path : false,
48 file_browser_callback : "fcFileBrowser",
49 setup : function(ed) {
51 ed.onKeyDown.add(function(ed,e) {
56 ed.onKeyUp.add(function(ed, e) {
57 var txt = tinyMCE.activeEditor.getContent();
58 match = txt.match(/@([^ \n]+)$/);
61 cPopup = new ACPopup(this,baseurl+"/acl");
63 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
64 if(! cPopup.ready) cPopup = null;
67 if(cPopup !== null) { cPopup.close(); cPopup = null; }
71 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
72 $('#profile-jot-desc').html(ispublic);
75 $('#profile-jot-desc').html(' ');
81 $('#character-counter').removeClass('red');
82 $('#character-counter').removeClass('orange');
83 $('#character-counter').addClass('grey');
85 if((textlen > 140) && (textlen <= 420)) {
86 $('#character-counter').removeClass('grey');
87 $('#character-counter').removeClass('red');
88 $('#character-counter').addClass('orange');
91 $('#character-counter').removeClass('grey');
92 $('#character-counter').removeClass('orange');
93 $('#character-counter').addClass('red');
95 $('#character-counter').text(textlen);
98 ed.onInit.add(function(ed) {
99 ed.pasteAsPlainText = true;
100 $("#profile-jot-text-loading").hide();
101 $(".jothidden").show();
102 if (typeof cb!="undefined") cb();
109 $("a#jot-perms-icon").colorbox({
111 'transition' : 'elastic'
114 if (typeof cb!="undefined") cb();
118 function enableOnUser(){
125 <script type="text/javascript" src="{{$baseurl}}/js/ajaxupload.js" ></script>
127 var ispublic = '{{$ispublic}}';
129 $(document).ready(function() {
131 /* enable tinymce on focus and click */
132 $("#profile-jot-text").focus(enableOnUser);
133 $("#profile-jot-text").click(enableOnUser);
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() {
162 if(confirm('{{$delitems}}')) {
165 $("#item-delete-selected").hide();
166 $('#item-delete-selected-rotator').show();
168 $('.item-select').each( function() {
169 if($(this).is(':checked')) {
170 if(checkedstr.length != 0) {
171 checkedstr = checkedstr + ',' + $(this).val();
174 checkedstr = $(this).val();
178 $.post('item', { dropitems: checkedstr }, function(data) {
179 window.location.reload();
184 function jotGetLink() {
185 reply = prompt("{{$linkurl}}");
186 if(reply && reply.length) {
187 reply = bin2hex(reply);
188 $('#profile-rotator').show();
189 $.get('parse_url?binurl=' + reply, function(data) {
191 $('#profile-rotator').hide();
196 function jotVideoURL() {
197 reply = prompt("{{$vidurl}}");
198 if(reply && reply.length) {
199 addeditortext('[video]' + reply + '[/video]');
203 function jotAudioURL() {
204 reply = prompt("{{$audurl}}");
205 if(reply && reply.length) {
206 addeditortext('[audio]' + reply + '[/audio]');
211 function jotGetLocation() {
212 reply = prompt("{{$whereareu}}", $('#jot-location').val());
213 if(reply && reply.length) {
214 $('#jot-location').val(reply);
218 function jotShare(id) {
219 if ($('#jot-popup').length != 0) $('#jot-popup').show();
221 $('#like-rotator-' + id).show();
222 $.get('share/' + id, function(data) {
223 if (!editor) $("#profile-jot-text").val("");
224 initEditor(function(){
226 $('#like-rotator-' + id).hide();
227 $(window).scrollTop(0);
233 function linkdropper(event) {
234 var linkFound = event.dataTransfer.types.contains("text/uri-list");
236 event.preventDefault();
239 function linkdrop(event) {
240 var reply = event.dataTransfer.getData("text/uri-list");
241 event.target.textContent = reply;
242 event.preventDefault();
243 if(reply && reply.length) {
244 reply = bin2hex(reply);
245 $('#profile-rotator').show();
246 $.get('parse_url?binurl=' + reply, function(data) {
247 if (!editor) $("#profile-jot-text").val("");
248 initEditor(function(){
250 $('#profile-rotator').hide();
256 function itemTag(id) {
257 reply = prompt("{{$term}}");
258 if(reply && reply.length) {
259 reply = reply.replace('#','');
263 $('body').css('cursor', 'wait');
265 $.get('tagger/' + id + '?term=' + reply);
266 if(timer) clearTimeout(timer);
267 timer = setTimeout(NavUpdate,3000);
273 function itemFiler(id) {
275 var bordercolor = $("input").css("border-color");
277 $.get('filer/', function(data){
278 $.colorbox({html:data});
279 $("#id_term").keypress(function(){
280 $(this).css("border-color",bordercolor);
282 $("#select_term").change(function(){
283 $("#id_term").css("border-color",bordercolor);
286 $("#filer_save").click(function(e){
288 reply = $("#id_term").val();
289 if(reply && reply.length) {
291 $('body').css('cursor', 'wait');
292 $.get('filer/' + id + '?term=' + reply, NavUpdate);
293 // if(timer) clearTimeout(timer);
294 // timer = setTimeout(NavUpdate,3000);
298 $("#id_term").css("border-color","#FF0000");
306 function jotClearLocation() {
307 $('#jot-coord').val('');
308 $('#profile-nolocation-wrapper').hide();
311 function addeditortext(data) {
312 if(plaintext == 'none') {
313 var currentText = $("#profile-jot-text").val();
314 $("#profile-jot-text").val(currentText + data);
317 tinyMCE.execCommand('mceInsertRawHTML',false,data);