1 <script type="text/javascript" src="$baseurl/library/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
2 <script type="text/javascript" src="$baseurl/js/ajaxupload.js"></script>
3 <script type="text/javascript">
7 var plaintext = '$editselect';
8 // this is here because of the silly tinymce error. didn't help.
11 function initEditor(cb) {
13 $("#profile-jot-text-loading").show();
14 if(plaintext == 'none') {
15 $("#profile-jot-text-loading").hide();
16 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
18 $("a#jot-perms-icon").fancybox({
19 'transitionIn' : 'elastic',
20 'transitionOut' : 'elastic'
22 $(".jothidden").show();
23 if (typeof cb!="undefined") cb();
28 mode : "specific_textareas",
29 editor_selector: $editselect,
30 auto_focus: "profile-jot-text",
31 plugins : "bbcode,paste,fullscreen,autoresize",
32 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen",
33 theme_advanced_buttons2 : "",
34 theme_advanced_buttons3 : "",
35 theme_advanced_toolbar_location : "top",
36 theme_advanced_toolbar_align : "center",
37 theme_advanced_blockformats : "blockquote,code",
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 : '',
46 content_css: "$baseurl/view/custom_tinymce.css",
47 theme_advanced_path : false,
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(){
123 var ispublic = '$ispublic';
124 var addtitle = '$addtitle';
126 $(document).ready(function() {
127 /* enable tinymce on focus and click */
128 $("#profile-jot-text").focus(enableOnUser);
129 $("#profile-jot-text").click(enableOnUser);
130 $("#profile-jot-text").focus(charCounter);
131 $("#profile-jot-text").click(charCounter);
133 var uploader = new window.AjaxUpload(
135 { action: 'wall_upload/$nickname',
137 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
138 onComplete: function(file,response) {
139 addeditortext(response);
140 $('#profile-rotator').hide();
144 var file_uploader = new window.AjaxUpload(
146 { action: 'wall_attach/$nickname',
148 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
149 onComplete: function(file,response) {
150 addeditortext(response);
151 $('#profile-rotator').hide();
159 function deleteCheckedItems() {
162 $('.item-select').each( function() {
163 if($(this).is(':checked')) {
164 if(checkedstr.length != 0) {
165 checkedstr = checkedstr + ',' + $(this).val();
168 checkedstr = $(this).val();
172 $.post('item', { dropitems: checkedstr }, function(data) {
173 window.location.reload();
177 function jotGetLink() {
178 reply = prompt("$linkurl");
179 if(reply && reply.length) {
180 reply = bin2hex(reply);
181 $('#profile-rotator').show();
182 $.get('parse_url?binurl=' + reply, function(data) {
184 $('#profile-rotator').hide();
189 function jotVideoURL() {
190 reply = prompt("$vidurl");
191 if(reply && reply.length) {
192 addeditortext('[video]' + reply + '[/video]');
196 function jotAudioURL() {
197 reply = prompt("$audurl");
198 if(reply && reply.length) {
199 addeditortext('[audio]' + reply + '[/audio]');
204 function jotGetLocation() {
205 reply = prompt("$whereareu", $('#jot-location').val());
206 if(reply && reply.length) {
207 $('#jot-location').val(reply);
211 function jotShare(id) {
212 if ($('#jot-popup').length != 0) $('#jot-popup').show();
214 $('#like-rotator-' + id).show();
215 $.get('share/' + id, function(data) {
216 if (!editor) $("#profile-jot-text").val("");
217 initEditor(function(){
219 $('#like-rotator-' + id).hide();
220 $(window).scrollTop(0);
226 function linkdropper(event) {
227 var linkFound = event.dataTransfer.types.contains("text/uri-list");
229 event.preventDefault();
232 function linkdrop(event) {
233 var reply = event.dataTransfer.getData("text/uri-list");
234 event.target.textContent = reply;
235 event.preventDefault();
236 if(reply && reply.length) {
237 reply = bin2hex(reply);
238 $('#profile-rotator').show();
239 $.get('parse_url?binurl=' + reply, function(data) {
240 if (!editor) $("#profile-jot-text").val("");
241 initEditor(function(){
243 $('#profile-rotator').hide();
249 function itemTag(id) {
250 reply = prompt("$term");
251 if(reply && reply.length) {
252 reply = reply.replace('#','');
256 $('body').css('cursor', 'wait');
258 $.get('tagger/' + id + '?term=' + reply);
259 if(timer) clearTimeout(timer);
260 timer = setTimeout(NavUpdate,3000);
266 function jotClearLocation() {
267 $('#jot-coord').val('');
268 $('#profile-nolocation-wrapper').hide();
271 function addeditortext(data) {
272 if(plaintext == 'none') {
273 var currentText = $("#profile-jot-text").val();
274 $("#profile-jot-text").val(currentText + data);
277 tinyMCE.execCommand('mceInsertRawHTML',false,data);
282 function charCounter() {
283 // character count part deux
284 //$(this).val().length is not a function Line 282(3)
285 $('#profile-jot-text').keyup(function() {
290 $('#character-counter').removeClass('jothidden');
292 textLen = $(this).val().length;
293 if(textLen <= maxLen1) {
294 $('#character-counter').removeClass('red');
295 $('#character-counter').removeClass('orange');
296 $('#character-counter').addClass('grey');
298 if((textLen > maxLen1) && (textlen <= maxLen2)) {
299 $('#character-counter').removeClass('grey');
300 $('#character-counter').removeClass('red');
301 $('#character-counter').addClass('orange');
303 if(textLen > maxLen2) {
304 $('#character-counter').removeClass('grey');
305 $('#character-counter').removeClass('orange');
306 $('#character-counter').addClass('red');
308 $('#character-counter').text( textLen );
310 $('#profile-jot-text').keyup();