1 function resizeIframe(obj) {
3 obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
6 function openClose(theID) {
7 if(document.getElementById(theID).style.display == "block") {
8 document.getElementById(theID).style.display = "none"
11 document.getElementById(theID).style.display = "block"
15 function openMenu(theID) {
16 document.getElementById(theID).style.display = "block"
19 function closeMenu(theID) {
20 document.getElementById(theID).style.display = "none"
28 var force_update = false;
30 var totStopped = false;
34 var in_progress = false;
35 var langSelect = false;
36 var commentBusy = false;
37 var last_popup_menu = null;
38 var last_popup_button = null;
41 $.ajaxSetup({cache: false});
43 /* setup tooltips *//*
44 $("a,.tt").each(function(){
47 if (e.hasClass("tttop")) pos="top";
48 if (e.hasClass("ttbottom")) pos="bottom";
49 if (e.hasClass("ttleft")) pos="left";
50 if (e.hasClass("ttright")) pos="right";
51 e.tipTip({defaultPosition: pos, edgeOffset: 8});
54 /* setup comment textarea buttons */
55 /* comment textarea buttons needs some "data-*" attributes to work:
56 * data-role="insert-formatting" : to mark the element as a formatting button
57 * data-comment="<string>" : string for "Comment", used by insertFormatting() function
58 * data-bbcode="<string>" : name of the bbcode element to insert. insertFormatting() will insert it as "[name][/name]"
59 * data-id="<string>" : id of the comment, used to find other comment-related element, like the textarea
61 $('body').on('click','[data-role="insert-formatting"]', function(e) {
64 var comment = o.data('comment');
65 var bbcode = o.data('bbcode');
66 var id = o.data('id');
68 Dialog.doImageBrowser("comment", id);
71 insertFormatting(comment, bbcode, id);
74 /* event from comment textarea button popups */
75 /* insert returned bbcode at cursor position or replace selected text */
76 $("body").on("fbrowser.image.comment", function(e, filename, bbcode, id) {
77 console.log("on", id);
79 var textarea = document.getElementById("comment-edit-text-" +id);
80 var start = textarea.selectionStart;
81 var end = textarea.selectionEnd;
82 textarea.value = textarea.value.substring(0, start) + bbcode + textarea.value.substring(end, textarea.value.length);
87 /* setup onoff widgets */
88 $(".onoff input").each(function(){
90 id = $(this).attr("id");
91 $("#"+id+"_onoff ."+ (val==0?"on":"off")).addClass("hidden");
94 $(".onoff > a").click(function(event){
95 event.preventDefault();
96 var input = $(this).siblings("input");
97 var val = 1-input.val();
98 var id = input.attr("id");
99 $("#"+id+"_onoff ."+ (val==0?"on":"off")).addClass("hidden");
100 $("#"+id+"_onoff ."+ (val==1?"on":"off")).removeClass("hidden");
105 /* setup field_richtext */
106 setupFieldRichtext();
109 function close_last_popup_menu() {
110 if(last_popup_menu) {
111 last_popup_menu.hide();
112 last_popup_button.removeClass("selected");
113 last_popup_menu = null;
114 last_popup_button = null;
117 $('a[rel^=#]').click(function(e){
119 var parent = $(this).parent();
120 var isSelected = (last_popup_button && parent.attr('id') == last_popup_button.attr('id'));
121 close_last_popup_menu();
122 if(isSelected) return false;
123 menu = $( $(this).attr('rel') );
126 if (menu.attr('popup')=="false") return false;
127 parent.toggleClass("selected");
129 if (menu.css("display") == "none") {
130 last_popup_menu = null;
131 last_popup_button = null;
133 last_popup_menu = menu;
134 last_popup_button = parent;
138 $('html').click(function() {
139 close_last_popup_menu();
143 $("a.popupbox").colorbox({
145 'transition' : 'elastic'
149 /* notifications template */
150 var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html());
151 var notifications_all = unescape($('<div>').append( $("#nav-notifications-see-all").clone() ).html()); //outerHtml hack
152 var notifications_mark = unescape($('<div>').append( $("#nav-notifications-mark-all").clone() ).html()); //outerHtml hack
153 var notifications_empty = unescape($("#nav-notifications-menu").html());
155 /* nav update event */
156 $('nav').bind('nav-update', function(e,data){
157 var invalid = $(data).find('invalid').text();
158 if(invalid == 1) { window.location.href=window.location.href }
160 var net = $(data).find('net').text();
161 if(net == 0) { net = ''; $('#net-update').removeClass('show') } else { $('#net-update').addClass('show') }
162 $('#net-update').html(net);
164 var home = $(data).find('home').text();
165 if(home == 0) { home = ''; $('#home-update').removeClass('show') } else { $('#home-update').addClass('show') }
166 $('#home-update').html(home);
168 var intro = $(data).find('intro').text();
169 if(intro == 0) { intro = ''; $('#intro-update').removeClass('show') } else { $('#intro-update').addClass('show') }
170 $('#intro-update').html(intro);
172 var mail = $(data).find('mail').text();
173 if(mail == 0) { mail = ''; $('#mail-update').removeClass('show') } else { $('#mail-update').addClass('show') }
174 $('#mail-update').html(mail);
176 var intro = $(data).find('intro').text();
177 if(intro == 0) { intro = ''; $('#intro-update-li').removeClass('show') } else { $('#intro-update-li').addClass('show') }
178 $('#intro-update-li').html(intro);
180 var mail = $(data).find('mail').text();
181 if(mail == 0) { mail = ''; $('#mail-update-li').removeClass('show') } else { $('#mail-update-li').addClass('show') }
182 $('#mail-update-li').html(mail);
185 var allevents = $(data).find('all-events').text();
186 if(allevents == 0) { allevents = ''; $('#allevents-update').removeClass('show') } else { $('#allevents-update').addClass('show') }
187 $('#allevents-update').html(allevents);
189 var alleventstoday = $(data).find('all-events-today').text();
190 if(alleventstoday == 0) { $('#allevents-update').removeClass('notif-allevents-today') } else { $('#allevents-update').addClass('notif-allevents-today') }
192 var events = $(data).find('events').text();
193 if(events == 0) { events = ''; $('#events-update').removeClass('show') } else { $('#events-update').addClass('show') }
194 $('#events-update').html(events);
196 var eventstoday = $(data).find('events-today').text();
197 if(eventstoday == 0) { $('#events-update').removeClass('notif-events-today') } else { $('#events-update').addClass('notif-events-today') }
199 var birthdays = $(data).find('birthdays').text();
200 if(birthdays == 0) {birthdays = ''; $('#birthdays-update').removeClass('show') } else { $('#birthdays-update').addClass('show') }
201 $('#birthdays-update').html(birthdays);
203 var birthdaystoday = $(data).find('birthdays-today').text();
204 if(birthdaystoday == 0) { $('#birthdays-update').removeClass('notif-birthdays-today') } else { $('#birthdays-update').addClass('notif-birthdays-today') }
206 $(".sidebar-group-li .notify").removeClass("show");
207 $(data).find("group").each(function() {
209 var gcount = this.innerHTML;
210 $(".group-"+gid+" .notify").addClass("show").text(gcount);
213 $(".forum-widget-entry .notify").removeClass("show");
214 $(data).find("forum").each(function() {
216 var fcount = this.innerHTML;
217 $(".forum-"+fid+" .notify").addClass("show").text(fcount);
221 var eNotif = $(data).find('notif')
223 if (eNotif.children("note").length==0){
224 $("#nav-notifications-menu").html(notifications_empty);
226 nnm = $("#nav-notifications-menu");
227 nnm.html(notifications_all + notifications_mark);
228 //nnm.attr('popup','true');
230 var notification_lastitem = parseInt(localStorage.getItem("notification-lastitem"));
231 var notification_id = 0;
232 eNotif.children("note").each(function(){
234 var text = e.text().format("<span class='contactname'>"+e.attr('name')+"</span>");
235 var seenclass = (e.attr('seen')==1)?"notify-seen":"notify-unseen";
236 var html = notifications_tpl.format(e.attr('href'),
237 e.attr('photo'), // {0}
239 e.attr('date'), // {2}
241 new Date(e.attr('timestamp')*1000) // {4}
245 $(eNotif.children("note").get().reverse()).each(function(){
247 notification_id = parseInt(e.attr('timestamp'));
248 if (notification_lastitem!== null && notification_id > notification_lastitem) {
249 if (getNotificationPermission()==="granted") {
250 var notification = new Notification(document.title, {
251 body: e.text().replace('→ ','').format(e.attr('name')),
252 icon: e.attr('photo'),
254 notification['url'] = e.attr('href');
255 notification.addEventListener("click", function(ev){
256 window.location = ev.target.url;
262 notification_lastitem = notification_id;
263 localStorage.setItem("notification-lastitem", notification_lastitem)
265 $("img[data-src]", nnm).each(function(i, el){
266 // Add src attribute for images with a data-src attribute
267 // However, don't bother if the data-src attribute is empty, because
268 // an empty "src" tag for an image will cause some browsers
269 // to prefetch the root page of the Friendica hub, which will
270 // unnecessarily load an entire profile/ or network/ page
271 if($(el).data("src") != '') $(el).attr('src', $(el).data("src"));
275 notif = eNotif.attr('count');
277 $("#nav-notifications-linkmenu").addClass("on");
279 $("#nav-notifications-linkmenu").removeClass("on");
281 if(notif == 0) { notif = ''; $('#notify-update').removeClass('show') } else { $('#notify-update').addClass('show') }
282 $('#notify-update').html(notif);
284 var eSysmsg = $(data).find('sysmsgs');
285 eSysmsg.children("notice").each(function(){
286 text = $(this).text();
287 $.jGrowl(text, { sticky: true, theme: 'notice' });
289 eSysmsg.children("info").each(function(){
290 text = $(this).text();
291 $.jGrowl(text, { sticky: false, theme: 'info', life: 5000 });
297 // Allow folks to stop the ajax page updates with the pause/break key
298 $(document).keydown(function(event) {
299 if(event.keyCode == '8') {
300 var target = event.target || event.srcElement;
301 if (!/input|textarea/i.test(target.nodeName)) {
305 if(event.keyCode == '19' || (event.ctrlKey && event.which == '32')) {
306 event.preventDefault();
307 if(stopped == false) {
312 $('#pause').html('<img src="images/pause.gif" alt="pause" style="border: 1px solid black;" />');
326 function NavUpdate() {
329 var pingCmd = 'ping' + ((localUser != 0) ? '?f=&uid=' + localUser : '');
330 $.get(pingCmd,function(data) {
331 $(data).find('result').each(function() {
332 // send nav-update event
333 $('nav').trigger('nav-update', this);
338 if($('#live-network').length) { src = 'network'; liveUpdate(); }
339 if($('#live-profile').length) { src = 'profile'; liveUpdate(); }
340 if($('#live-community').length) { src = 'community'; liveUpdate(); }
341 if($('#live-notes').length) { src = 'notes'; liveUpdate(); }
342 if($('#live-display').length) { src = 'display'; liveUpdate(); }
343 /* if($('#live-display').length) {
346 window.location.href=window.location.href
349 if($('#live-photos').length) {
352 window.location.href=window.location.href
362 timer = setTimeout(NavUpdate,updateInterval);
365 function liveUpdate() {
366 if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; }
367 if(($('.comment-edit-text-full').length) || (in_progress)) {
369 clearTimeout(livetime);
371 livetime = setTimeout(liveUpdate, 5000);
377 prev = 'live-' + src;
381 if ($(document).scrollTop() == 0)
384 var udargs = ((netargs.length) ? '/' + netargs : '');
385 var update_url = 'update_' + src + udargs + '&p=' + profile_uid + '&page=' + profile_page + '&force=' + ((force_update) ? 1 : 0);
387 $.get(update_url,function(data) {
389 force_update = false;
390 // $('.collapsed-comments',data).each(function() {
391 // var ident = $(this).attr('id');
392 // var is_hidden = $('#' + ident).is(':hidden');
393 // if($('#' + ident).length) {
394 // $('#' + ident).replaceWith($(this));
396 // $('#' + ident).hide();
401 $('.toplevel_item',data).each(function() {
402 var ident = $(this).attr('id');
404 if($('#' + ident).length == 0 && profile_page == 1) {
405 $('img',this).each(function() {
406 $(this).attr('src',$(this).attr('dst'));
408 $('#' + prev).after($(this));
411 // Find out if the hidden comments are open, so we can keep it that way
412 // if a new comment has been posted
413 var id = $('.hide-comments-total', this).attr('id');
414 if(typeof id != 'undefined') {
415 id = id.split('-')[3];
416 var commentsOpen = $("#collapsed-comments-" + id).is(":visible");
419 $('img',this).each(function() {
420 $(this).attr('src',$(this).attr('dst'));
422 //vScroll = $(document).scrollTop();
423 $('html').height($('html').height());
424 $('#' + ident).replaceWith($(this));
426 if(typeof id != 'undefined') {
427 if(commentsOpen) showHideComments(id);
429 $('html').height('auto');
430 //$(document).scrollTop(vScroll);
435 // reset vars for inserting individual items
437 /* prev = 'live-' + src;
439 $('.wall-item-outside-wrapper',data).each(function() {
440 var ident = $(this).attr('id');
442 if($('#' + ident).length == 0 && prev != 'live-' + src) {
443 $('img',this).each(function() {
444 $(this).attr('src',$(this).attr('dst'));
446 $('#' + prev).after($(this));
449 $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago'));
450 if($('#' + ident + ' ' + '.comment-edit-text-empty').length)
451 $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper'));
452 $('#' + ident + ' ' + '.hide-comments-total').replaceWith($(this).find('.hide-comments-total'));
453 $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like'));
454 $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike'));
455 $('#' + ident + ' ' + '.my-comment-photo').each(function() {
456 $(this).attr('src',$(this).attr('dst'));
462 $('.like-rotator').hide();
465 $('body').css('cursor', 'auto');
467 /* autocomplete @nicknames */
468 $(".comment-edit-form textarea").contact_autocomplete(baseurl+"/acl");
470 // setup videos, since VideoJS won't take care of any loaded via AJAX
471 if(typeof videojs != 'undefined') videojs.autoSetup();
475 function imgbright(node) {
476 $(node).removeClass("drophide").addClass("drop");
479 function imgdull(node) {
480 $(node).removeClass("drop").addClass("drophide");
483 // Since our ajax calls are asynchronous, we will give a few
484 // seconds for the first ajax call (setting like/dislike), then
485 // run the updater to pick up any changes and display on the page.
486 // The updater will turn any rotators off when it's done.
487 // This function will have returned long before any of these
488 // events have completed and therefore there won't be any
489 // visible feedback that anything changed without all this
490 // trickery. This still could cause confusion if the "like" ajax call
491 // is delayed and NavUpdate runs before it completes.
493 function dolike(ident,verb) {
495 $('#like-rotator-' + ident.toString()).show();
496 $.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate );
501 function dosubthread(ident) {
503 $('#like-rotator-' + ident.toString()).show();
504 $.get('subthread/' + ident.toString(), NavUpdate );
509 function dostar(ident) {
510 ident = ident.toString();
511 $('#like-rotator-' + ident).show();
512 $.get('starred/' + ident, function(data) {
513 if(data.match(/1/)) {
514 $('#starred-' + ident).addClass('starred');
515 $('#starred-' + ident).removeClass('unstarred');
516 $('#star-' + ident).addClass('hidden');
517 $('#unstar-' + ident).removeClass('hidden');
520 $('#starred-' + ident).addClass('unstarred');
521 $('#starred-' + ident).removeClass('starred');
522 $('#star-' + ident).removeClass('hidden');
523 $('#unstar-' + ident).addClass('hidden');
525 $('#like-rotator-' + ident).hide();
529 function doignore(ident) {
530 ident = ident.toString();
531 $('#like-rotator-' + ident).show();
532 $.get('ignored/' + ident, function(data) {
533 if(data.match(/1/)) {
534 $('#ignored-' + ident).addClass('ignored');
535 $('#ignored-' + ident).removeClass('unignored');
536 $('#ignore-' + ident).addClass('hidden');
537 $('#unignore-' + ident).removeClass('hidden');
540 $('#ignored-' + ident).addClass('unignored');
541 $('#ignored-' + ident).removeClass('ignored');
542 $('#ignore-' + ident).removeClass('hidden');
543 $('#unignore-' + ident).addClass('hidden');
545 $('#like-rotator-' + ident).hide();
549 function getPosition(e) {
550 var cursor = {x:0, y:0};
551 if ( e.pageX || e.pageY ) {
556 if( e.clientX || e.clientY ) {
557 cursor.x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
558 cursor.y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
570 var lockvisible = false;
572 function lockview(event,id) {
573 event = event || window.event;
574 cursor = getPosition(event);
580 $.get('lockview/' + id, function(data) {
581 $('#panel').html(data);
582 $('#panel').css({ 'left': cursor.x + 5 , 'top': cursor.y + 5});
588 function lockviewhide() {
593 function post_comment(id) {
596 $('body').css('cursor', 'wait');
597 $("#comment-preview-inp-" + id).val("0");
600 $("#comment-edit-form-" + id).serialize(),
603 $("#comment-edit-wrapper-" + id).hide();
604 $("#comment-edit-text-" + id).val('');
605 var tarea = document.getElementById("comment-edit-text-" + id);
607 commentClose(tarea,id);
608 if(timer) clearTimeout(timer);
609 timer = setTimeout(NavUpdate,10);
613 window.location.href=data.reload;
622 function preview_comment(id) {
623 $("#comment-preview-inp-" + id).val("1");
624 $("#comment-edit-preview-" + id).show();
627 $("#comment-edit-form-" + id).serialize(),
630 $("#comment-edit-preview-" + id).html(data.preview);
631 $("#comment-edit-preview-" + id + " a").click(function() { return false; });
641 function showHideComments(id) {
642 if( $("#collapsed-comments-" + id).is(":visible")) {
643 $("#collapsed-comments-" + id).hide();
644 $("#hide-comments-" + id).html(window.showMore);
647 $("#collapsed-comments-" + id).show();
648 $("#hide-comments-" + id).html(window.showFewer);
654 function preview_post() {
655 $("#jot-preview").val("1");
656 $("#jot-preview-content").show();
657 tinyMCE.triggerSave();
660 $("#profile-jot-form").serialize(),
663 $("#jot-preview-content").html(data.preview);
664 $("#jot-preview-content" + " a").click(function() { return false; });
669 $("#jot-preview").val("0");
675 // unpause auto reloads if they are currently stopped
678 $('#pause').html('');
683 // Converts the binary representation of data to hex
686 // discuss at: http://phpjs.org/functions/bin2hex
687 // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
688 // + bugfixed by: Onno Marsman
689 // + bugfixed by: Linuxworld
690 // * example 1: bin2hex('Kev');
691 // * returns 1: '4b6576'
692 // * example 2: bin2hex(String.fromCharCode(0x00));
694 var v,i, f = 0, a = [];
698 for (i = 0; i<f; i++) {
699 a[i] = s.charCodeAt(i).toString(16).replace(/^([\da-f])$/,"0$1");
705 function groupChangeMember(gid, cid, sec_token) {
706 $('body .fakelink').css('cursor', 'wait');
707 $.get('group/' + gid + '/' + cid + "?t=" + sec_token, function(data) {
708 $('#group-update-wrapper').html(data);
709 $('body .fakelink').css('cursor', 'auto');
713 function profChangeMember(gid,cid) {
714 $('body .fakelink').css('cursor', 'wait');
715 $.get('profperm/' + gid + '/' + cid, function(data) {
716 $('#prof-update-wrapper').html(data);
717 $('body .fakelink').css('cursor', 'auto');
721 function contactgroupChangeMember(gid,cid) {
722 $('body').css('cursor', 'wait');
723 $.get('contactgroup/' + gid + '/' + cid, function(data) {
724 $('body').css('cursor', 'auto');
729 function checkboxhighlight(box) {
730 if($(box).is(':checked')) {
731 $(box).addClass('checkeditem');
734 $(box).removeClass('checkeditem');
738 function notifyMarkAll() {
739 $.get('notify/mark/all', function(data) {
740 if(timer) clearTimeout(timer);
741 timer = setTimeout(NavUpdate,1000);
747 // code from http://www.tinymce.com/wiki.php/How-to_implement_a_custom_file_browser
748 function fcFileBrowser (field_name, url, type, win) {
749 /* TODO: If you work with sessions in PHP and your client doesn't accept cookies you might need to carry
750 the session name and session ID in the request string (can look like this: "?PHPSESSID=88p0n70s9dsknra96qhuk6etm5").
751 These lines of code extract the necessary parameters and add them back to the filebrowser URL again. */
754 var cmsURL = baseurl+"/fbrowser/"+type+"/";
756 tinyMCE.activeEditor.windowManager.open({
758 title : 'File Browser',
759 width : 420, // Your dimensions may differ - toy around with them!
762 inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin!
763 close_previous : "no"
771 function setupFieldRichtext(){
774 mode : "specific_textareas",
775 editor_selector: "fieldRichtext",
776 plugins : "bbcode,paste, inlinepopups",
777 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
778 theme_advanced_buttons2 : "",
779 theme_advanced_buttons3 : "",
780 theme_advanced_toolbar_location : "top",
781 theme_advanced_toolbar_align : "center",
782 theme_advanced_blockformats : "blockquote,code",
783 theme_advanced_resizing : true,
784 paste_text_sticky : true,
785 entity_encoding : "raw",
786 add_unload_trigger : false,
787 remove_linebreaks : false,
788 //force_p_newlines : false,
789 //force_br_newlines : true,
790 forced_root_block : 'div',
792 content_css: baseurl+"/view/custom_tinymce.css",
793 theme_advanced_path : false,
794 file_browser_callback : "fcFileBrowser",
800 * sprintf in javascript
801 * "{0} and {1}".format('zero','uno');
803 String.prototype.format = function() {
804 var formatted = this;
805 for (var i = 0; i < arguments.length; i++) {
806 var regexp = new RegExp('\\{'+i+'\\}', 'gi');
807 formatted = formatted.replace(regexp, arguments[i]);
812 Array.prototype.remove = function(item) {
813 to=undefined; from=this.indexOf(item);
814 var rest = this.slice((to || from) + 1 || this.length);
815 this.length = from < 0 ? this.length + from : from;
816 return this.push.apply(this, rest);
819 function previewTheme(elm) {
820 theme = $(elm).val();
821 $.getJSON('pretheme?f=&theme=' + theme,function(data) {
822 $('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><div id="theme-version">' + data.version + '</div><div id="theme-credits">' + data.credits + '</div><a href="' + data.img + '"><img src="' + data.img + '" width="320" height="240" alt="' + theme + '" /></a>');
827 // notification permission settings in localstorage
828 // set by settings page
829 function getNotificationPermission() {
830 if (window["Notification"] === undefined) {
833 if (Notification.permission === 'granted') {
834 var val = localStorage.getItem('notification-permissions');
835 if (val === null) return 'denied';
838 return Notification.permission;
843 * Show a dialog loaded from an url
844 * By defaults this load the url in an iframe in colorbox
845 * Themes can overwrite `show()` function to personalize it
852 * @return object colorbox
854 show : function (url) {
855 var size = Dialog._get_size();
856 return $.colorbox({href: url, iframe:true,innerWidth: size.width+'px',innerHeight: size.height+'px'})
860 * Show the Image browser dialog
863 * @param string id (optional)
866 * The name will be used to build the event name
867 * fired by image browser dialog when the user select
868 * an image. The optional id will be passed as argument
869 * to the event handler
871 doImageBrowser : function (name, id) {
872 var url = Dialog._get_url("image",name,id);
873 return Dialog.show(url);
877 * Show the File browser dialog
880 * @param string id (optional)
883 * The name will be used to build the event name
884 * fired by file browser dialog when the user select
885 * a file. The optional id will be passed as argument
886 * to the event handler
888 doFileBrowser : function (name, id) {
889 var url = Dialog._get_url("file",name,id);
890 return Dialog.show(url);
893 _get_url : function(type, name, id) {
895 if (id !== undefined) hash = hash + "-" + id;
896 return baseurl + "/fbrowser/"+type+"/?mode=minimal#"+hash;
899 _get_size: function() {
901 width: window.innerWidth-50,
902 height: window.innerHeight-100