3 <script language="javascript" type="text/javascript" src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
4 <script language="javascript" type="text/javascript">
8 var plaintext = '{{$editselect}}';
10 function initEditor(cb) {
12 $("#profile-jot-text-loading").show();
13 if(plaintext == 'none') {
14 $("#profile-jot-text-loading").hide();
15 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
16 $(".jothidden").show();
18 $("a#jot-perms-icon").colorbox({
20 'transition' : 'elastic'
22 $("#profile-jot-submit-wrapper").show();
24 $("#profile-upload-wrapper").show();
25 $("#profile-attach-wrapper").show();
26 $("#profile-link-wrapper").show();
27 $("#profile-video-wrapper").show();
28 $("#profile-audio-wrapper").show();
29 $("#profile-location-wrapper").show();
30 $("#profile-nolocation-wrapper").show();
31 $("#profile-title-wrapper").show();
32 $("#profile-jot-plugin-wrapper").show();
33 $("#jot-preview-link").show();
37 if (typeof cb!="undefined") cb();
42 mode : "specific_textareas",
43 editor_selector: /(profile-jot-text|prvmail-text)/,
44 plugins : "bbcode,paste,fullscreen,autoresize",
45 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen",
46 theme_advanced_buttons2 : "",
47 theme_advanced_buttons3 : "",
48 theme_advanced_toolbar_location : "top",
49 theme_advanced_toolbar_align : "center",
50 theme_advanced_blockformats : "blockquote,code",
51 //theme_advanced_resizing : true,
52 //theme_advanced_statusbar_location : "bottom",
53 paste_text_sticky : true,
54 entity_encoding : "raw",
55 add_unload_trigger : false,
56 remove_linebreaks : false,
57 //force_p_newlines : false,
58 //force_br_newlines : true,
59 forced_root_block : 'div',
61 content_css: "{{$baseurl}}/view/custom_tinymce.css",
62 theme_advanced_path : false,
63 setup : function(ed) {
65 ed.onKeyDown.add(function(ed,e) {
72 ed.onKeyUp.add(function(ed, e) {
73 var txt = tinyMCE.activeEditor.getContent();
74 match = txt.match(/@([^ \n]+)$/);
77 cPopup = new ACPopup(this,baseurl+"/acl");
79 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
80 if(! cPopup.ready) cPopup = null;
83 if(cPopup !== null) { cPopup.close(); cPopup = null; }
87 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
88 $('#profile-jot-desc').html(ispublic);
91 $('#profile-jot-desc').html(' ');
97 $('#character-counter').removeClass('red');
98 $('#character-counter').removeClass('orange');
99 $('#character-counter').addClass('grey');
101 if((textlen > 140) && (textlen <= 420)) {
102 $('#character-counter').removeClass('grey');
103 $('#character-counter').removeClass('red');
104 $('#character-counter').addClass('orange');
107 $('#character-counter').removeClass('grey');
108 $('#character-counter').removeClass('orange');
109 $('#character-counter').addClass('red');
111 $('#character-counter').text(textlen);
113 ed.onInit.add(function(ed) {
114 ed.pasteAsPlainText = true;
115 $("#profile-jot-text-loading").hide();
116 $(".jothidden").show();
117 $("#profile-jot-submit-wrapper").show();
119 $("#profile-upload-wrapper").show();
120 $("#profile-attach-wrapper").show();
121 $("#profile-link-wrapper").show();
122 $("#profile-video-wrapper").show();
123 $("#profile-audio-wrapper").show();
124 $("#profile-location-wrapper").show();
125 $("#profile-nolocation-wrapper").show();
126 $("#profile-title-wrapper").show();
127 $("#profile-jot-plugin-wrapper").show();
128 $("#jot-preview-link").show();
130 $("#character-counter").show();
131 if (typeof cb!="undefined") cb();
137 $("a#jot-perms-icon").colorbox({
139 'transition' : 'elastic'
142 if (typeof cb!="undefined") cb();
146 <script type="text/javascript" src="js/ajaxupload.js" ></script>
148 var ispublic = '{{$ispublic}}';
149 $(document).ready(function() {
150 /* enable tinymce on focus */
151 $("#profile-jot-text").focus(function(){
158 var uploader = new window.AjaxUpload(
160 { action: 'wall_upload/{{$nickname}}',
162 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
163 onComplete: function(file,response) {
164 addeditortext(response);
165 $('#profile-rotator').hide();
169 var file_uploader = new window.AjaxUpload(
171 { action: 'wall_attach/{{$nickname}}',
173 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
174 onComplete: function(file,response) {
175 addeditortext(response);
176 $('#profile-rotator').hide();
180 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
182 $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
183 selstr = $(this).text();
184 $('#jot-perms-icon').removeClass('unlock').addClass('lock');
185 $('#jot-public').hide();
186 $('.profile-jot-net input').attr('disabled', 'disabled');
189 $('#jot-perms-icon').removeClass('lock').addClass('unlock');
190 $('#jot-public').show();
191 $('.profile-jot-net input').attr('disabled', false);
194 }).trigger('change');
198 function deleteCheckedItems() {
199 if(confirm('{{$delitems}}')) {
202 $("#item-delete-selected").hide();
203 $('#item-delete-selected-rotator').show();
205 $('.item-select').each( function() {
206 if($(this).is(':checked')) {
207 if(checkedstr.length != 0) {
208 checkedstr = checkedstr + ',' + $(this).val();
211 checkedstr = $(this).val();
215 $.post('item', { dropitems: checkedstr }, function(data) {
216 window.location.reload();
221 function jotGetLink() {
222 reply = prompt("{{$linkurl}}");
223 if(reply && reply.length) {
224 reply = bin2hex(reply);
225 $('#profile-rotator').show();
226 $.get('parse_url?binurl=' + reply, function(data) {
228 $('#profile-rotator').hide();
233 function jotVideoURL() {
234 reply = prompt("{{$vidurl}}");
235 if(reply && reply.length) {
236 addeditortext('[video]' + reply + '[/video]');
240 function jotAudioURL() {
241 reply = prompt("{{$audurl}}");
242 if(reply && reply.length) {
243 addeditortext('[audio]' + reply + '[/audio]');
248 function jotGetLocation() {
249 reply = prompt("{{$whereareu}}", $('#jot-location').val());
250 if(reply && reply.length) {
251 $('#jot-location').val(reply);
255 function jotTitle() {
256 reply = prompt("{{$title}}", $('#jot-title').val());
257 if(reply && reply.length) {
258 $('#jot-title').val(reply);
262 function jotShare(id) {
263 $('#like-rotator-' + id).show();
264 $.get('share/' + id, function(data) {
265 if (!editor) $("#profile-jot-text").val("");
266 initEditor(function(){
268 $('#like-rotator-' + id).hide();
269 $(window).scrollTop(0);
274 function linkdropper(event) {
275 var linkFound = event.dataTransfer.types.contains("text/uri-list");
277 event.preventDefault();
280 function linkdrop(event) {
281 var reply = event.dataTransfer.getData("text/uri-list");
282 event.target.textContent = reply;
283 event.preventDefault();
284 if(reply && reply.length) {
285 reply = bin2hex(reply);
286 $('#profile-rotator').show();
287 $.get('parse_url?binurl=' + reply, function(data) {
288 if (!editor) $("#profile-jot-text").val("");
289 initEditor(function(){
291 $('#profile-rotator').hide();
297 function itemTag(id) {
298 reply = prompt("{{$term}}");
299 if(reply && reply.length) {
300 reply = reply.replace('#','');
304 $('body').css('cursor', 'wait');
306 $.get('tagger/' + id + '?term=' + reply);
307 if(timer) clearTimeout(timer);
308 timer = setTimeout(NavUpdate,3000);
314 function itemFiler(id) {
316 var bordercolor = $("input").css("border-color");
318 $.get('filer/', function(data){
319 $.colorbox({html:data});
320 $("#id_term").keypress(function(){
321 $(this).css("border-color",bordercolor);
323 $("#select_term").change(function(){
324 $("#id_term").css("border-color",bordercolor);
327 $("#filer_save").click(function(e){
329 reply = $("#id_term").val();
330 if(reply && reply.length) {
332 $('body').css('cursor', 'wait');
333 $.get('filer/' + id + '?term=' + reply);
334 if(timer) clearTimeout(timer);
335 timer = setTimeout(NavUpdate,3000);
339 $("#id_term").css("border-color","#FF0000");
349 function jotClearLocation() {
350 $('#jot-coord').val('');
351 $('#profile-nolocation-wrapper').hide();
354 function addeditortext(data) {
355 if(plaintext == 'none') {
356 var currentText = $("#profile-jot-text").val();
357 $("#profile-jot-text").val(currentText + data);
360 tinyMCE.execCommand('mceInsertRawHTML',false,data);