2 <script language="javascript" type="text/javascript">
6 var plaintext = '$editselect';
8 function initEditor(cb){
10 $("#profile-jot-text-loading").show();
11 if(plaintext == 'none') {
12 $("#profile-jot-text-loading").hide();
13 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
14 $("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
16 $("a#jot-perms-icon").fancybox({
17 'transitionIn' : 'elastic',
18 'transitionOut' : 'elastic'
20 $(".jothidden").show();
21 if (typeof cb!="undefined") cb();
26 mode : "specific_textareas",
27 editor_selector: $editselect,
28 auto_focus: "profile-jot-text",
29 plugins : "bbcode,paste,autoresize, inlinepopups",
30 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
31 theme_advanced_buttons2 : "",
32 theme_advanced_buttons3 : "",
33 theme_advanced_toolbar_location : "top",
34 theme_advanced_toolbar_align : "center",
35 theme_advanced_blockformats : "blockquote,code",
36 gecko_spellcheck : true,
37 paste_text_sticky : true,
38 entity_encoding : "raw",
39 add_unload_trigger : false,
40 remove_linebreaks : false,
41 force_p_newlines : false,
42 force_br_newlines : true,
43 forced_root_block : '',
45 content_css: "$baseurl/view/custom_tinymce.css",
46 theme_advanced_path : false,
47 file_browser_callback : "fcFileBrowser",
48 setup : function(ed) {
50 ed.onKeyDown.add(function(ed,e) {
55 ed.onKeyUp.add(function(ed, e) {
56 var txt = tinyMCE.activeEditor.getContent();
57 match = txt.match(/@([^ \n]+)$/);
60 cPopup = new ACPopup(this,baseurl+"/acl");
62 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
63 if(! cPopup.ready) cPopup = null;
66 if(cPopup !== null) { cPopup.close(); cPopup = null; }
70 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
71 $('#profile-jot-desc').html(ispublic);
74 $('#profile-jot-desc').html(' ');
80 $('#character-counter').removeClass('red');
81 $('#character-counter').removeClass('orange');
82 $('#character-counter').addClass('grey');
84 if((textlen > 140) && (textlen <= 420)) {
85 $('#character-counter').removeClass('grey');
86 $('#character-counter').removeClass('red');
87 $('#character-counter').addClass('orange');
90 $('#character-counter').removeClass('grey');
91 $('#character-counter').removeClass('orange');
92 $('#character-counter').addClass('red');
94 $('#character-counter').text(textlen);
97 ed.onInit.add(function(ed) {
98 ed.pasteAsPlainText = true;
99 $("#profile-jot-text-loading").hide();
100 $(".jothidden").show();
101 if (typeof cb!="undefined") cb();
108 $("a#jot-perms-icon").fancybox({
109 'transitionIn' : 'elastic',
110 'transitionOut' : 'elastic'
113 if (typeof cb!="undefined") cb();
117 function enableOnUser(){
124 <script type="text/javascript" src="$baseurl/js/ajaxupload.js" ></script>
126 var ispublic = '$ispublic';
128 $(document).ready(function() {
130 /* enable tinymce on focus and click */
131 $("#profile-jot-text").focus(enableOnUser);
132 $("#profile-jot-text").click(enableOnUser);
134 var uploader = new window.AjaxUpload(
136 { action: 'wall_upload/$nickname',
138 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
139 onComplete: function(file,response) {
140 addeditortext(response);
141 $('#profile-rotator').hide();
145 var file_uploader = new window.AjaxUpload(
147 { action: 'wall_attach/$nickname',
149 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
150 onComplete: function(file,response) {
151 addeditortext(response);
152 $('#profile-rotator').hide();
160 function deleteCheckedItems() {
163 $('.item-select').each( function() {
164 if($(this).is(':checked')) {
165 if(checkedstr.length != 0) {
166 checkedstr = checkedstr + ',' + $(this).val();
169 checkedstr = $(this).val();
173 $.post('item', { dropitems: checkedstr }, function(data) {
174 window.location.reload();
178 function jotGetLink() {
179 reply = prompt("$linkurl");
180 if(reply && reply.length) {
181 reply = bin2hex(reply);
182 $('#profile-rotator').show();
183 $.get('parse_url?binurl=' + reply, function(data) {
185 $('#profile-rotator').hide();
190 function jotVideoURL() {
191 reply = prompt("$vidurl");
192 if(reply && reply.length) {
193 addeditortext('[video]' + reply + '[/video]');
197 function jotAudioURL() {
198 reply = prompt("$audurl");
199 if(reply && reply.length) {
200 addeditortext('[audio]' + reply + '[/audio]');
205 function jotGetLocation() {
206 reply = prompt("$whereareu", $('#jot-location').val());
207 if(reply && reply.length) {
208 $('#jot-location').val(reply);
212 function jotShare(id) {
213 if ($('#jot-popup').length != 0) $('#jot-popup').show();
215 $('#like-rotator-' + id).show();
216 $.get('share/' + id, function(data) {
217 if (!editor) $("#profile-jot-text").val("");
218 initEditor(function(){
220 $('#like-rotator-' + id).hide();
221 $(window).scrollTop(0);
227 function linkdropper(event) {
228 var linkFound = event.dataTransfer.types.contains("text/uri-list");
230 event.preventDefault();
233 function linkdrop(event) {
234 var reply = event.dataTransfer.getData("text/uri-list");
235 event.target.textContent = reply;
236 event.preventDefault();
237 if(reply && reply.length) {
238 reply = bin2hex(reply);
239 $('#profile-rotator').show();
240 $.get('parse_url?binurl=' + reply, function(data) {
241 if (!editor) $("#profile-jot-text").val("");
242 initEditor(function(){
244 $('#profile-rotator').hide();
250 function itemTag(id) {
251 reply = prompt("$term");
252 if(reply && reply.length) {
253 reply = reply.replace('#','');
257 $('body').css('cursor', 'wait');
259 $.get('tagger/' + id + '?term=' + reply);
260 if(timer) clearTimeout(timer);
261 timer = setTimeout(NavUpdate,3000);
267 function itemFiler(id) {
269 var bordercolor = $("input").css("border-color");
271 $.get('filer/', function(data){
273 $("#id_term").keypress(function(){
274 $(this).css("border-color",bordercolor);
276 $("#select_term").change(function(){
277 $("#id_term").css("border-color",bordercolor);
280 $("#filer_save").click(function(e){
282 reply = $("#id_term").val();
283 if(reply && reply.length) {
285 $('body').css('cursor', 'wait');
286 $.get('filer/' + id + '?term=' + reply);
287 if(timer) clearTimeout(timer);
288 timer = setTimeout(NavUpdate,3000);
292 $("#id_term").css("border-color","#FF0000");
300 function jotClearLocation() {
301 $('#jot-coord').val('');
302 $('#profile-nolocation-wrapper').hide();
305 function addeditortext(data) {
306 if(plaintext == 'none') {
307 var currentText = $("#profile-jot-text").val();
308 $("#profile-jot-text").val(currentText + data);
311 tinyMCE.execCommand('mceInsertRawHTML',false,data);