2 <script language="javascript" type="text/javascript">
6 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' });
16 $("a#jot-perms-icon").fancybox({
17 'transitionIn' : 'elastic',
18 'transitionOut' : 'elastic'
20 $(".jothidden").show();
21 if (typeof cb!="undefined") {
29 mode : "specific_textareas",
30 editor_selector: $editselect,
31 auto_focus: "profile-jot-text",
32 plugins : "bbcode,paste,fullscreen,autoresize",
33 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen",
34 theme_advanced_buttons2 : "",
35 theme_advanced_buttons3 : "",
36 theme_advanced_toolbar_location : "top",
37 theme_advanced_toolbar_align : "center",
38 theme_advanced_blockformats : "blockquote,code",
39 paste_text_sticky : true,
40 entity_encoding : "raw",
41 add_unload_trigger : false,
42 remove_linebreaks : false,
43 force_p_newlines : false,
44 force_br_newlines : true,
45 forced_root_block : '',
47 content_css: "$baseurl/view/custom_tinymce.css",
48 theme_advanced_path : false,
49 setup : function(ed) {
51 ed.onKeyDown.add(function(ed,e) {
57 ed.onKeyUp.add(function(ed, e) {
58 var txt = tinyMCE.activeEditor.getContent();
59 match = txt.match(/@([^ \n]+)$/);
62 cPopup = new ACPopup(this,baseurl+"/acl");
64 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
65 if(! cPopup.ready) { cPopup = null; }
68 if(cPopup !== null) { cPopup.close(); cPopup = null; }
72 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
73 $('#profile-jot-desc').html(ispublic);
76 $('#profile-jot-desc').html(' ');
82 $('#character-counter').removeClass('red');
83 $('#character-counter').removeClass('orange');
84 $('#character-counter').addClass('grey');
86 if((textlen > 140) && (textlen <= 420)) {
87 $('#character-counter').removeClass('grey');
88 $('#character-counter').removeClass('red');
89 $('#character-counter').addClass('orange');
92 $('#character-counter').removeClass('grey');
93 $('#character-counter').removeClass('orange');
94 $('#character-counter').addClass('red');
96 $('#character-counter').text(textlen);
99 ed.onInit.add(function(ed) {
100 ed.pasteAsPlainText = true;
101 $("#profile-jot-text-loading").hide();
102 $(".jothidden").show();
103 if (typeof cb!="undefined") cb();
109 $("a#jot-perms-icon").fancybox({
110 'transitionIn' : 'elastic',
111 'transitionOut' : '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';
128 var addtitle = '$addtitle';
130 $(document).ready(function() {
132 /* enable tinymce on focus and click */
133 $("#profile-jot-text").focus(enableOnUser);
134 $("#profile-jot-text").click(enableOnUser);
136 var uploader = new window.AjaxUpload(
138 { action: 'wall_upload/$nickname',
140 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
141 onComplete: function(file,response) {
142 addeditortext(response);
143 $('#profile-rotator').hide();
147 var file_uploader = new window.AjaxUpload(
149 { action: 'wall_attach/$nickname',
151 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
152 onComplete: function(file,response) {
153 addeditortext(response);
154 $('#profile-rotator').hide();
162 function deleteCheckedItems() {
165 $('.item-select').each( function() {
166 if($(this).is(':checked')) {
167 if(checkedstr.length != 0) {
168 checkedstr = checkedstr + ',' + $(this).val();
171 checkedstr = $(this).val();
175 $.post('item', { dropitems: checkedstr }, function(data) {
176 window.location.reload();
180 function jotGetLink() {
181 reply = prompt("$linkurl");
182 if(reply && reply.length) {
183 reply = bin2hex(reply);
184 $('#profile-rotator').show();
185 $.get('parse_url?binurl=' + reply, function(data) {
187 $('#profile-rotator').hide();
192 function jotVideoURL() {
193 reply = prompt("$vidurl");
194 if(reply && reply.length) {
195 addeditortext('[video]' + reply + '[/video]');
199 function jotAudioURL() {
200 reply = prompt("$audurl");
201 if(reply && reply.length) {
202 addeditortext('[audio]' + reply + '[/audio]');
207 function jotGetLocation() {
208 reply = prompt("$whereareu", $('#jot-location').val());
209 if(reply && reply.length) {
210 $('#jot-location').val(reply);
214 function jotShare(id) {
215 if ($('#jot-popup').length != 0) $('#jot-popup').show();
217 $('#like-rotator-' + id).show();
218 $.get('share/' + id, function(data) {
219 if (!editor) $("#profile-jot-text").val("");
220 initEditor(function(){
222 $('#like-rotator-' + id).hide();
223 $(window).scrollTop(0);
229 function linkdropper(event) {
230 var linkFound = event.dataTransfer.types.contains("text/uri-list");
232 event.preventDefault();
235 function linkdrop(event) {
236 var reply = event.dataTransfer.getData("text/uri-list");
237 event.target.textContent = reply;
238 event.preventDefault();
239 if(reply && reply.length) {
240 reply = bin2hex(reply);
241 $('#profile-rotator').show();
242 $.get('parse_url?binurl=' + reply, function(data) {
243 if (!editor) $("#profile-jot-text").val("");
244 initEditor(function(){
246 $('#profile-rotator').hide();
252 function itemTag(id) {
253 reply = prompt("$term");
254 if(reply && reply.length) {
255 reply = reply.replace('#','');
259 $('body').css('cursor', 'wait');
261 $.get('tagger/' + id + '?term=' + reply);
262 if(timer) clearTimeout(timer);
263 timer = setTimeout(NavUpdate,3000);
269 function jotClearLocation() {
270 $('#jot-coord').val('');
271 $('#profile-nolocation-wrapper').hide();
274 function addeditortext(data) {
275 if(plaintext == 'none') {
276 var currentText = $("#profile-jot-text").val();
277 $("#profile-jot-text").val(currentText + data);
280 tinyMCE.execCommand('mceInsertRawHTML',false,data);