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' });
15 $("a#jot-perms-icon").fancybox({
16 'transitionIn' : 'elastic',
17 'transitionOut' : 'elastic'
19 $(".jothidden").show();
20 if (typeof cb!="undefined") cb();
25 mode : "specific_textareas",
26 editor_selector: $editselect,
27 auto_focus: "profile-jot-text",
28 plugins : "bbcode,paste,autoresize",
29 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
30 theme_advanced_buttons2 : "",
31 theme_advanced_buttons3 : "",
32 theme_advanced_toolbar_location : "top",
33 theme_advanced_toolbar_align : "center",
34 theme_advanced_blockformats : "blockquote,code",
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 setup : function(ed) {
47 ed.onKeyDown.add(function(ed,e) {
52 ed.onKeyUp.add(function(ed, e) {
53 var txt = tinyMCE.activeEditor.getContent();
54 match = txt.match(/@([^ \n]+)$/);
57 cPopup = new ACPopup(this,baseurl+"/acl");
59 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
60 if(! cPopup.ready) cPopup = null;
63 if(cPopup !== null) { cPopup.close(); cPopup = null; }
67 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
68 $('#profile-jot-desc').html(ispublic);
71 $('#profile-jot-desc').html(' ');
77 $('#character-counter').removeClass('red');
78 $('#character-counter').removeClass('orange');
79 $('#character-counter').addClass('grey');
81 if((textlen > 140) && (textlen <= 420)) {
82 $('#character-counter').removeClass('grey');
83 $('#character-counter').removeClass('red');
84 $('#character-counter').addClass('orange');
87 $('#character-counter').removeClass('grey');
88 $('#character-counter').removeClass('orange');
89 $('#character-counter').addClass('red');
91 $('#character-counter').text(textlen);
94 ed.onInit.add(function(ed) {
95 ed.pasteAsPlainText = true;
96 $("#profile-jot-text-loading").hide();
97 $(".jothidden").show();
98 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>
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);
132 var uploader = new window.AjaxUpload(
134 { action: 'wall_upload/$nickname',
136 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
137 onComplete: function(file,response) {
138 addeditortext(response);
139 $('#profile-rotator').hide();
143 var file_uploader = new window.AjaxUpload(
145 { action: 'wall_attach/$nickname',
147 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
148 onComplete: function(file,response) {
149 addeditortext(response);
150 $('#profile-rotator').hide();
158 function deleteCheckedItems() {
161 $('.item-select').each( function() {
162 if($(this).is(':checked')) {
163 if(checkedstr.length != 0) {
164 checkedstr = checkedstr + ',' + $(this).val();
167 checkedstr = $(this).val();
171 $.post('item', { dropitems: checkedstr }, function(data) {
172 window.location.reload();
176 function jotGetLink() {
177 reply = prompt("$linkurl");
178 if(reply && reply.length) {
179 reply = bin2hex(reply);
180 $('#profile-rotator').show();
181 $.get('parse_url?binurl=' + reply, function(data) {
183 $('#profile-rotator').hide();
188 function jotVideoURL() {
189 reply = prompt("$vidurl");
190 if(reply && reply.length) {
191 addeditortext('[video]' + reply + '[/video]');
195 function jotAudioURL() {
196 reply = prompt("$audurl");
197 if(reply && reply.length) {
198 addeditortext('[audio]' + reply + '[/audio]');
203 function jotGetLocation() {
204 reply = prompt("$whereareu", $('#jot-location').val());
205 if(reply && reply.length) {
206 $('#jot-location').val(reply);
210 function jotShare(id) {
211 if ($('#jot-popup').length != 0) $('#jot-popup').show();
213 $('#like-rotator-' + id).show();
214 $.get('share/' + id, function(data) {
215 if (!editor) $("#profile-jot-text").val("");
216 initEditor(function(){
218 $('#like-rotator-' + id).hide();
219 $(window).scrollTop(0);
225 function linkdropper(event) {
226 var linkFound = event.dataTransfer.types.contains("text/uri-list");
228 event.preventDefault();
231 function linkdrop(event) {
232 var reply = event.dataTransfer.getData("text/uri-list");
233 event.target.textContent = reply;
234 event.preventDefault();
235 if(reply && reply.length) {
236 reply = bin2hex(reply);
237 $('#profile-rotator').show();
238 $.get('parse_url?binurl=' + reply, function(data) {
239 if (!editor) $("#profile-jot-text").val("");
240 initEditor(function(){
242 $('#profile-rotator').hide();
248 function itemTag(id) {
249 reply = prompt("$term");
250 if(reply && reply.length) {
251 reply = reply.replace('#','');
255 $('body').css('cursor', 'wait');
257 $.get('tagger/' + id + '?term=' + reply);
258 if(timer) clearTimeout(timer);
259 timer = setTimeout(NavUpdate,3000);
265 function jotClearLocation() {
266 $('#jot-coord').val('');
267 $('#profile-nolocation-wrapper').hide();
270 function addeditortext(data) {
271 if(plaintext == 'none') {
272 var currentText = $("#profile-jot-text").val();
273 $("#profile-jot-text").val(currentText + data);
276 tinyMCE.execCommand('mceInsertRawHTML',false,data);