2 * AUTOMATICALLY GENERATED TEMPLATE
3 * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
7 <script language="javascript" type="text/javascript">
11 var plaintext = '{{$editselect}}';
13 function initEditor(cb){
15 $("#profile-jot-text-loading").show();
16 if(plaintext == 'none') {
17 $("#profile-jot-text-loading").hide();
18 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
19 $("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
21 $("a#jot-perms-icon").colorbox({
23 'transition' : 'elastic'
25 $(".jothidden").show();
26 if (typeof cb!="undefined") cb();
31 mode : "specific_textareas",
32 editor_selector: {{$editselect}},
33 auto_focus: "profile-jot-text",
34 plugins : "bbcode,paste,autoresize, inlinepopups",
35 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
36 theme_advanced_buttons2 : "",
37 theme_advanced_buttons3 : "",
38 theme_advanced_toolbar_location : "top",
39 theme_advanced_toolbar_align : "center",
40 theme_advanced_blockformats : "blockquote,code",
41 gecko_spellcheck : true,
42 paste_text_sticky : true,
43 entity_encoding : "raw",
44 add_unload_trigger : false,
45 remove_linebreaks : false,
46 //force_p_newlines : false,
47 //force_br_newlines : true,
48 forced_root_block : 'div',
50 content_css: "{{$baseurl}}/view/custom_tinymce.css",
51 theme_advanced_path : false,
52 file_browser_callback : "fcFileBrowser",
53 setup : function(ed) {
55 ed.onKeyDown.add(function(ed,e) {
60 ed.onKeyUp.add(function(ed, e) {
61 var txt = tinyMCE.activeEditor.getContent();
62 match = txt.match(/@([^ \n]+)$/);
65 cPopup = new ACPopup(this,baseurl+"/acl");
67 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
68 if(! cPopup.ready) cPopup = null;
71 if(cPopup !== null) { cPopup.close(); cPopup = null; }
75 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
76 $('#profile-jot-desc').html(ispublic);
79 $('#profile-jot-desc').html(' ');
85 $('#character-counter').removeClass('red');
86 $('#character-counter').removeClass('orange');
87 $('#character-counter').addClass('grey');
89 if((textlen > 140) && (textlen <= 420)) {
90 $('#character-counter').removeClass('grey');
91 $('#character-counter').removeClass('red');
92 $('#character-counter').addClass('orange');
95 $('#character-counter').removeClass('grey');
96 $('#character-counter').removeClass('orange');
97 $('#character-counter').addClass('red');
99 $('#character-counter').text(textlen);
102 ed.onInit.add(function(ed) {
103 ed.pasteAsPlainText = true;
104 $("#profile-jot-text-loading").hide();
105 $(".jothidden").show();
106 if (typeof cb!="undefined") cb();
113 $("a#jot-perms-icon").colorbox({
115 'transition' : 'elastic'
118 if (typeof cb!="undefined") cb();
122 function enableOnUser(){
129 <script type="text/javascript" src="{{$baseurl}}/js/ajaxupload.js" ></script>
131 var ispublic = '{{$ispublic}}';
133 $(document).ready(function() {
135 /* enable tinymce on focus and click */
136 $("#profile-jot-text").focus(enableOnUser);
137 $("#profile-jot-text").click(enableOnUser);
139 var uploader = new window.AjaxUpload(
141 { action: 'wall_upload/{{$nickname}}',
143 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
144 onComplete: function(file,response) {
145 addeditortext(response);
146 $('#profile-rotator').hide();
150 var file_uploader = new window.AjaxUpload(
152 { action: 'wall_attach/{{$nickname}}',
154 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
155 onComplete: function(file,response) {
156 addeditortext(response);
157 $('#profile-rotator').hide();
165 function deleteCheckedItems() {
166 if(confirm('{{$delitems}}')) {
169 $("#item-delete-selected").hide();
170 $('#item-delete-selected-rotator').show();
172 $('.item-select').each( function() {
173 if($(this).is(':checked')) {
174 if(checkedstr.length != 0) {
175 checkedstr = checkedstr + ',' + $(this).val();
178 checkedstr = $(this).val();
182 $.post('item', { dropitems: checkedstr }, function(data) {
183 window.location.reload();
188 function jotGetLink() {
189 reply = prompt("{{$linkurl}}");
190 if(reply && reply.length) {
191 reply = bin2hex(reply);
192 $('#profile-rotator').show();
193 $.get('parse_url?binurl=' + reply, function(data) {
195 $('#profile-rotator').hide();
200 function jotVideoURL() {
201 reply = prompt("{{$vidurl}}");
202 if(reply && reply.length) {
203 addeditortext('[video]' + reply + '[/video]');
207 function jotAudioURL() {
208 reply = prompt("{{$audurl}}");
209 if(reply && reply.length) {
210 addeditortext('[audio]' + reply + '[/audio]');
215 function jotGetLocation() {
216 reply = prompt("{{$whereareu}}", $('#jot-location').val());
217 if(reply && reply.length) {
218 $('#jot-location').val(reply);
222 function jotShare(id) {
223 if ($('#jot-popup').length != 0) $('#jot-popup').show();
225 $('#like-rotator-' + id).show();
226 $.get('share/' + id, function(data) {
227 if (!editor) $("#profile-jot-text").val("");
228 initEditor(function(){
230 $('#like-rotator-' + id).hide();
231 $(window).scrollTop(0);
237 function linkdropper(event) {
238 var linkFound = event.dataTransfer.types.contains("text/uri-list");
240 event.preventDefault();
243 function linkdrop(event) {
244 var reply = event.dataTransfer.getData("text/uri-list");
245 event.target.textContent = reply;
246 event.preventDefault();
247 if(reply && reply.length) {
248 reply = bin2hex(reply);
249 $('#profile-rotator').show();
250 $.get('parse_url?binurl=' + reply, function(data) {
251 if (!editor) $("#profile-jot-text").val("");
252 initEditor(function(){
254 $('#profile-rotator').hide();
260 function itemTag(id) {
261 reply = prompt("{{$term}}");
262 if(reply && reply.length) {
263 reply = reply.replace('#','');
267 $('body').css('cursor', 'wait');
269 $.get('tagger/' + id + '?term=' + reply);
270 if(timer) clearTimeout(timer);
271 timer = setTimeout(NavUpdate,3000);
277 function itemFiler(id) {
279 var bordercolor = $("input").css("border-color");
281 $.get('filer/', function(data){
282 $.colorbox({html:data});
283 $("#id_term").keypress(function(){
284 $(this).css("border-color",bordercolor);
286 $("#select_term").change(function(){
287 $("#id_term").css("border-color",bordercolor);
290 $("#filer_save").click(function(e){
292 reply = $("#id_term").val();
293 if(reply && reply.length) {
295 $('body').css('cursor', 'wait');
296 $.get('filer/' + id + '?term=' + reply, NavUpdate);
297 // if(timer) clearTimeout(timer);
298 // timer = setTimeout(NavUpdate,3000);
302 $("#id_term").css("border-color","#FF0000");
310 function jotClearLocation() {
311 $('#jot-coord').val('');
312 $('#profile-nolocation-wrapper').hide();
315 function addeditortext(data) {
316 if(plaintext == 'none') {
317 var currentText = $("#profile-jot-text").val();
318 $("#profile-jot-text").val(currentText + data);
321 tinyMCE.execCommand('mceInsertRawHTML',false,data);