2 <script language="javascript" type="text/javascript">
7 function initEditor(cb){
9 $("#profile-jot-text-loading").show();
10 $("#jot-title-desc").show();
13 mode : "specific_textareas",
14 editor_selector: /(profile-jot-text|prvmail-text)/,
15 auto_focus: "profile-jot-text",
16 plugins : "bbcode,paste,autoresize",
17 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
18 theme_advanced_buttons2 : "",
19 theme_advanced_buttons3 : "",
20 theme_advanced_toolbar_location : "top",
21 theme_advanced_toolbar_align : "center",
22 theme_advanced_blockformats : "blockquote,code",
23 paste_text_sticky : true,
24 entity_encoding : "raw",
25 add_unload_trigger : false,
26 remove_linebreaks : false,
27 force_p_newlines : false,
28 force_br_newlines : true,
29 forced_root_block : '',
31 content_css: "$baseurl/view/custom_tinymce.css",
32 theme_advanced_path : false,
33 setup : function(ed) {
35 ed.onKeyDown.add(function(ed,e) {
40 ed.onKeyUp.add(function(ed, e) {
41 var txt = tinyMCE.activeEditor.getContent();
42 match = txt.match(/@([^ \n]+)$/);
45 cPopup = new ACPopup(this,baseurl+"/acl");
47 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
48 if(! cPopup.ready) cPopup = null;
51 if(cPopup !== null) { cPopup.close(); cPopup = null; }
55 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
56 $('#profile-jot-desc').html(ispublic);
59 $('#profile-jot-desc').html(' ');
65 $('#character-counter').removeClass('red');
66 $('#character-counter').removeClass('orange');
67 $('#character-counter').addClass('grey');
69 if((textlen > 140) && (textlen <= 420)) {
70 $('#character-counter').removeClass('grey');
71 $('#character-counter').removeClass('red');
72 $('#character-counter').addClass('orange');
75 $('#character-counter').removeClass('grey');
76 $('#character-counter').removeClass('orange');
77 $('#character-counter').addClass('red');
79 $('#character-counter').text(textlen);
82 ed.onInit.add(function(ed) {
83 ed.pasteAsPlainText = true;
84 $("#profile-jot-text-loading").hide();
85 $(".jothidden").show();
86 if (typeof cb!="undefined") cb();
93 $("a#jot-perms-icon").fancybox({
94 'transitionIn' : 'elastic',
95 'transitionOut' : 'elastic'
98 if (typeof cb!="undefined") cb();
102 function enableOnUser(){
109 <script type="text/javascript" src="js/ajaxupload.js" ></script>
111 var ispublic = '$ispublic';
112 var addtitle = '$addtitle';
114 $(document).ready(function() {
116 /* enable tinymce on focus and click */
117 $("#profile-jot-text").focus(enableOnUser);
118 $("#profile-jot-text").click(enableOnUser);
121 var uploader = new window.AjaxUpload(
123 { action: 'wall_upload/$nickname',
125 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
126 onComplete: function(file,response) {
127 tinyMCE.execCommand('mceInsertRawHTML',false,response);
128 $('#profile-rotator').hide();
132 var file_uploader = new window.AjaxUpload(
134 { action: 'wall_attach/$nickname',
136 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
137 onComplete: function(file,response) {
138 tinyMCE.execCommand('mceInsertRawHTML',false,response);
139 $('#profile-rotator').hide();
147 function deleteCheckedItems() {
150 $('.item-select').each( function() {
151 if($(this).is(':checked')) {
152 if(checkedstr.length != 0) {
153 checkedstr = checkedstr + ',' + $(this).val();
156 checkedstr = $(this).val();
160 $.post('item', { dropitems: checkedstr }, function(data) {
161 window.location.reload();
165 function jotGetLink() {
166 reply = prompt("$linkurl");
167 if(reply && reply.length) {
168 reply = bin2hex(reply);
169 $('#profile-rotator').show();
170 $.get('parse_url?binurl=' + reply, function(data) {
171 tinyMCE.execCommand('mceInsertRawHTML',false,data);
172 $('#profile-rotator').hide();
177 function jotVideoURL() {
178 reply = prompt("$vidurl");
179 if(reply && reply.length) {
180 tinyMCE.execCommand('mceInsertRawHTML',false,'[video]' + reply + '[/video]');
184 function jotAudioURL() {
185 reply = prompt("$audurl");
186 if(reply && reply.length) {
187 tinyMCE.execCommand('mceInsertRawHTML',false,'[audio]' + reply + '[/audio]');
192 function jotGetLocation() {
193 reply = prompt("$whereareu", $('#jot-location').val());
194 if(reply && reply.length) {
195 $('#jot-location').val(reply);
199 function jotTitle() {
200 reply = prompt("$title", $('#jot-title').val());
201 if(reply && reply.length) {
202 $('#jot-title').val(reply);
207 function jotShare(id) {
208 $('#like-rotator-' + id).show();
209 $.get('share/' + id, function(data) {
210 if (!editor) $("#profile-jot-text").val("");
211 initEditor(function(){
212 tinyMCE.execCommand('mceInsertRawHTML',false,data);
213 $('#like-rotator-' + id).hide();
214 $(window).scrollTop(0);
220 function linkdropper(event) {
221 var linkFound = event.dataTransfer.types.contains("text/uri-list");
223 event.preventDefault();
226 function linkdrop(event) {
227 var reply = event.dataTransfer.getData("text/uri-list");
228 event.target.textContent = reply;
229 event.preventDefault();
230 if(reply && reply.length) {
231 reply = bin2hex(reply);
232 $('#profile-rotator').show();
233 $.get('parse_url?binurl=' + reply, function(data) {
234 if (!editor) $("#profile-jot-text").val("");
235 initEditor(function(){
236 tinyMCE.execCommand('mceInsertRawHTML',false,data);
237 $('#profile-rotator').hide();
243 function itemTag(id) {
244 reply = prompt("$term");
245 if(reply && reply.length) {
246 reply = reply.replace('#','');
250 $('body').css('cursor', 'wait');
252 $.get('tagger/' + id + '?term=' + reply);
253 if(timer) clearTimeout(timer);
254 timer = setTimeout(NavUpdate,3000);
260 function jotClearLocation() {
261 $('#jot-coord').val('');
262 $('#profile-nolocation-wrapper').hide();