1 function resizeIframe(obj) {
2 //obj.style.height = 0;
6 function _resizeIframe(obj, desth) {
7 var h = obj.style.height;
8 var ch = obj.contentWindow.document.body.scrollHeight;
9 if (h == (ch + 'px')) {
12 if (desth == ch && ch>0) {
13 obj.style.height = ch + 'px';
15 setTimeout(_resizeIframe, 100, obj, ch);
18 function openClose(theID) {
19 if(document.getElementById(theID).style.display == "block") {
20 document.getElementById(theID).style.display = "none"
23 document.getElementById(theID).style.display = "block"
27 function openMenu(theID) {
28 document.getElementById(theID).style.display = "block"
31 function closeMenu(theID) {
32 document.getElementById(theID).style.display = "none"
35 function decodeHtml(html) {
36 var txt = document.createElement("textarea");
45 var force_update = false;
47 var totStopped = false;
51 var in_progress = false;
52 var langSelect = false;
53 var commentBusy = false;
54 var last_popup_menu = null;
55 var last_popup_button = null;
56 var lockLoadContent = false;
59 $.ajaxSetup({cache: false});
61 /* setup tooltips *//*
62 $("a,.tt").each(function(){
65 if (e.hasClass("tttop")) pos="top";
66 if (e.hasClass("ttbottom")) pos="bottom";
67 if (e.hasClass("ttleft")) pos="left";
68 if (e.hasClass("ttright")) pos="right";
69 e.tipTip({defaultPosition: pos, edgeOffset: 8});
72 /* setup comment textarea buttons */
73 /* comment textarea buttons needs some "data-*" attributes to work:
74 * data-role="insert-formatting" : to mark the element as a formatting button
75 * data-comment="<string>" : string for "Comment", used by insertFormatting() function
76 * data-bbcode="<string>" : name of the bbcode element to insert. insertFormatting() will insert it as "[name][/name]"
77 * data-id="<string>" : id of the comment, used to find other comment-related element, like the textarea
79 $('body').on('click','[data-role="insert-formatting"]', function(e) {
82 var comment = o.data('comment');
83 var bbcode = o.data('bbcode');
84 var id = o.data('id');
86 Dialog.doImageBrowser("comment", id);
89 insertFormatting(comment, bbcode, id);
92 /* event from comment textarea button popups */
93 /* insert returned bbcode at cursor position or replace selected text */
94 $("body").on("fbrowser.image.comment", function(e, filename, bbcode, id) {
96 var textarea = document.getElementById("comment-edit-text-" +id);
97 var start = textarea.selectionStart;
98 var end = textarea.selectionEnd;
99 textarea.value = textarea.value.substring(0, start) + bbcode + textarea.value.substring(end, textarea.value.length);
104 /* setup onoff widgets */
105 $(".onoff input").each(function(){
107 id = $(this).attr("id");
108 $("#"+id+"_onoff ."+ (val==0?"on":"off")).addClass("hidden");
111 $(".onoff > a").click(function(event){
112 event.preventDefault();
113 var input = $(this).siblings("input");
114 var val = 1-input.val();
115 var id = input.attr("id");
116 $("#"+id+"_onoff ."+ (val==0?"on":"off")).addClass("hidden");
117 $("#"+id+"_onoff ."+ (val==1?"on":"off")).removeClass("hidden");
121 /* setup field_richtext */
122 setupFieldRichtext();
125 function close_last_popup_menu() {
126 if(last_popup_menu) {
127 last_popup_menu.hide();
128 last_popup_menu.off('click', function(e) {e.stopPropagation()});
129 last_popup_button.removeClass("selected");
130 last_popup_menu = null;
131 last_popup_button = null;
134 $('a[rel^=#]').click(function(e){
136 var parent = $(this).parent();
137 var isSelected = (last_popup_button && parent.attr('id') == last_popup_button.attr('id'));
138 close_last_popup_menu();
139 if(isSelected) return false;
140 menu = $( $(this).attr('rel') );
143 if (menu.attr('popup')=="false") return false;
144 parent.toggleClass("selected");
146 if (menu.css("display") == "none") {
147 last_popup_menu = null;
148 last_popup_button = null;
150 last_popup_menu = menu;
151 last_popup_menu.on('click', function(e) {e.stopPropagation()});
152 last_popup_button = parent;
153 $('#nav-notifications-menu').perfectScrollbar('update');
157 $('html').click(function() {
158 close_last_popup_menu();
162 $("a.popupbox").colorbox({
164 'transition' : 'elastic'
166 $("a.ajax-popupbox").colorbox({
167 'transition' : 'elastic'
170 /* notifications template */
171 var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html());
172 var notifications_all = unescape($('<div>').append( $("#nav-notifications-see-all").clone() ).html()); //outerHtml hack
173 var notifications_mark = unescape($('<div>').append( $("#nav-notifications-mark-all").clone() ).html()); //outerHtml hack
174 var notifications_empty = unescape($("#nav-notifications-menu").html());
176 /* enable perfect-scrollbars for different elements */
177 $('#nav-notifications-menu, aside').perfectScrollbar();
179 /* nav update event */
180 $('nav').bind('nav-update', function(e, data){
181 var invalid = data.invalid || 0;
182 if(invalid == 1) { window.location.href=window.location.href }
184 ['net', 'home', 'intro', 'mail', 'events', 'birthdays', 'notify'].forEach(function(type) {
185 var number = data[type];
188 $('#' + type + '-update').removeClass('show');
190 $('#' + type + '-update').addClass('show');
192 $('#' + type + '-update').text(number);
195 var intro = data['intro'];
196 if(intro == 0) { intro = ''; $('#intro-update-li').removeClass('show') } else { $('#intro-update-li').addClass('show') }
197 $('#intro-update-li').html(intro);
199 var mail = data['mail'];
200 if(mail == 0) { mail = ''; $('#mail-update-li').removeClass('show') } else { $('#mail-update-li').addClass('show') }
201 $('#mail-update-li').html(mail);
203 $(".sidebar-group-li .notify").removeClass("show");
204 $(data.groups).each(function(key, group) {
206 var gcount = group.count;
207 $(".group-"+gid+" .notify").addClass("show").text(gcount);
210 $(".forum-widget-entry .notify").removeClass("show");
211 $(data.forums).each(function(key, forum) {
213 var fcount = forum.count;
214 $(".forum-"+fid+" .notify").addClass("show").text(fcount);
217 if (data.notifications.length == 0) {
218 $("#nav-notifications-menu").html(notifications_empty);
220 var nnm = $("#nav-notifications-menu");
221 nnm.html(notifications_all + notifications_mark);
223 var notification_lastitem = parseInt(localStorage.getItem("notification-lastitem"));
224 var notification_id = 0;
225 $(data.notifications).each(function(key, notif){
226 var text = notif.message.format('<span class="contactname">' + notif.name + '</span>');
227 var contact = ('<a href="' + notif.url + '"><span class="contactname">' + notif.name + '</span></a>');
228 var seenclass = (notif.seen == 1) ? "notify-seen" : "notify-unseen";
229 var html = notifications_tpl.format(
230 notif.href, // {0} // link to the source
231 notif.photo, // {1} // photo of the contact
232 text, // {2} // preformatted text (autor + text)
233 notif.date, // {3} // date of notification (time ago)
234 seenclass, // {4} // visited status of the notification
235 new Date(notif.timestamp*1000), // {5} // date of notification
236 notif.url, // {6} // profile url of the contact
237 notif.message.format(contact), // {7} // preformatted html (text including author profile url)
238 '' // {8} // Deprecated
242 $(data.notifications.reverse()).each(function(key, e){
243 notification_id = parseInt(e.timestamp);
244 if (notification_lastitem !== null && notification_id > notification_lastitem) {
245 if (getNotificationPermission() === "granted") {
246 var notification = new Notification(document.title, {
247 body: decodeHtml(e.message.replace('→ ', '').format(e.name)),
250 notification['url'] = e.href;
251 notification.addEventListener("click", function(ev){
252 window.location = ev.target.url;
258 notification_lastitem = notification_id;
259 localStorage.setItem("notification-lastitem", notification_lastitem)
261 $("img[data-src]", nnm).each(function(i, el){
262 // Add src attribute for images with a data-src attribute
263 // However, don't bother if the data-src attribute is empty, because
264 // an empty "src" tag for an image will cause some browsers
265 // to prefetch the root page of the Friendica hub, which will
266 // unnecessarily load an entire profile/ or network/ page
267 if($(el).data("src") != '') $(el).attr('src', $(el).data("src"));
271 var notif = data['notify'];
273 $("#nav-notifications-linkmenu").addClass("on");
275 $("#nav-notifications-linkmenu").removeClass("on");
278 $(data.sysmsgs.notice).each(function(key, message){
279 $.jGrowl(message, {sticky: true, theme: 'notice'});
281 $(data.sysmsgs.info).each(function(key, message){
282 $.jGrowl(message, {sticky: false, theme: 'info', life: 5000});
285 /* update the js scrollbars */
286 $('#nav-notifications-menu').perfectScrollbar('update');
291 // Allow folks to stop the ajax page updates with the pause/break key
292 $(document).keydown(function(event) {
293 if(event.keyCode == '8') {
294 var target = event.target || event.srcElement;
295 if (!/input|textarea/i.test(target.nodeName)) {
299 if(event.keyCode == '19' || (event.ctrlKey && event.which == '32')) {
300 event.preventDefault();
301 if(stopped == false) {
306 $('#pause').html('<img src="images/pause.gif" alt="pause" style="border: 1px solid black;" />');
317 // Set an event listener for infinite scroll
318 if(typeof infinite_scroll !== 'undefined') {
319 $(window).scroll(function(e){
320 if ($(document).height() != $(window).height()) {
321 // First method that is expected to work - but has problems with Chrome
322 if ($(window).scrollTop() > ($(document).height() - $(window).height() * 1.5))
325 // This method works with Chrome - but seems to be much slower in Firefox
326 if ($(window).scrollTop() > (($("section").height() + $("header").height() + $("footer").height()) - $(window).height() * 1.5))
335 function NavUpdate() {
338 var pingCmd = 'ping?format=json' + ((localUser != 0) ? '&f=&uid=' + localUser : '');
339 $.get(pingCmd, function(data) {
341 // send nav-update event
342 $('nav').trigger('nav-update', data.result);
345 ['network', 'profile', 'community', 'notes', 'display'].forEach(function (src) {
346 if ($('#live-' + src).length) {
350 if ($('#live-photos').length) {
353 window.location.href = window.location.href;
359 timer = setTimeout(NavUpdate, updateInterval);
362 function liveUpdate(src) {
363 if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; }
364 if(($('.comment-edit-text-full').length) || (in_progress)) {
366 clearTimeout(livetime);
368 livetime = setTimeout(function() {liveUpdate(src)}, 5000);
374 prev = 'live-' + src;
378 if ($(document).scrollTop() == 0)
381 var udargs = ((netargs.length) ? '/' + netargs : '');
382 var update_url = 'update_' + src + udargs + '&p=' + profile_uid + '&page=' + profile_page + '&force=' + ((force_update) ? 1 : 0);
384 $.get(update_url,function(data) {
386 force_update = false;
387 // $('.collapsed-comments',data).each(function() {
388 // var ident = $(this).attr('id');
389 // var is_hidden = $('#' + ident).is(':hidden');
390 // if($('#' + ident).length) {
391 // $('#' + ident).replaceWith($(this));
393 // $('#' + ident).hide();
398 $('.toplevel_item',data).each(function() {
399 var ident = $(this).attr('id');
401 if($('#' + ident).length == 0 && profile_page == 1) {
402 $('img',this).each(function() {
403 $(this).attr('src',$(this).attr('dst'));
405 $('#' + prev).after($(this));
408 // Find out if the hidden comments are open, so we can keep it that way
409 // if a new comment has been posted
410 var id = $('.hide-comments-total', this).attr('id');
411 if(typeof id != 'undefined') {
412 id = id.split('-')[3];
413 var commentsOpen = $("#collapsed-comments-" + id).is(":visible");
416 $('img',this).each(function() {
417 $(this).attr('src',$(this).attr('dst'));
419 //vScroll = $(document).scrollTop();
420 $('html').height($('html').height());
421 $('#' + ident).replaceWith($(this));
423 if(typeof id != 'undefined') {
424 if(commentsOpen) showHideComments(id);
426 $('html').height('auto');
427 //$(document).scrollTop(vScroll);
432 // reset vars for inserting individual items
434 /* prev = 'live-' + src;
436 $('.wall-item-outside-wrapper',data).each(function() {
437 var ident = $(this).attr('id');
439 if($('#' + ident).length == 0 && prev != 'live-' + src) {
440 $('img',this).each(function() {
441 $(this).attr('src',$(this).attr('dst'));
443 $('#' + prev).after($(this));
446 $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago'));
447 if($('#' + ident + ' ' + '.comment-edit-text-empty').length)
448 $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper'));
449 $('#' + ident + ' ' + '.hide-comments-total').replaceWith($(this).find('.hide-comments-total'));
450 $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like'));
451 $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike'));
452 $('#' + ident + ' ' + '.my-comment-photo').each(function() {
453 $(this).attr('src',$(this).attr('dst'));
459 $('.like-rotator').hide();
462 $('body').css('cursor', 'auto');
464 /* autocomplete @nicknames */
465 $(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl");
466 /* autocomplete bbcode */
467 $(".comment-edit-form textarea").bbco_autocomplete('bbcode');
469 // setup videos, since VideoJS won't take care of any loaded via AJAX
470 if(typeof videojs != 'undefined') videojs.autoSetup();
474 function imgbright(node) {
475 $(node).removeClass("drophide").addClass("drop");
478 function imgdull(node) {
479 $(node).removeClass("drop").addClass("drophide");
482 // Since our ajax calls are asynchronous, we will give a few
483 // seconds for the first ajax call (setting like/dislike), then
484 // run the updater to pick up any changes and display on the page.
485 // The updater will turn any rotators off when it's done.
486 // This function will have returned long before any of these
487 // events have completed and therefore there won't be any
488 // visible feedback that anything changed without all this
489 // trickery. This still could cause confusion if the "like" ajax call
490 // is delayed and NavUpdate runs before it completes.
492 function dolike(ident,verb) {
494 $('#like-rotator-' + ident.toString()).show();
495 $.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate );
500 function dosubthread(ident) {
502 $('#like-rotator-' + ident.toString()).show();
503 $.get('subthread/' + ident.toString(), NavUpdate );
508 function dostar(ident) {
509 ident = ident.toString();
510 $('#like-rotator-' + ident).show();
511 $.get('starred/' + ident, function(data) {
512 if(data.match(/1/)) {
513 $('#starred-' + ident).addClass('starred');
514 $('#starred-' + ident).removeClass('unstarred');
515 $('#star-' + ident).addClass('hidden');
516 $('#unstar-' + ident).removeClass('hidden');
519 $('#starred-' + ident).addClass('unstarred');
520 $('#starred-' + ident).removeClass('starred');
521 $('#star-' + ident).removeClass('hidden');
522 $('#unstar-' + ident).addClass('hidden');
524 $('#like-rotator-' + ident).hide();
528 function doignore(ident) {
529 ident = ident.toString();
530 $('#like-rotator-' + ident).show();
531 $.get('ignored/' + ident, function(data) {
532 if(data.match(/1/)) {
533 $('#ignored-' + ident).addClass('ignored');
534 $('#ignored-' + ident).removeClass('unignored');
535 $('#ignore-' + ident).addClass('hidden');
536 $('#unignore-' + ident).removeClass('hidden');
539 $('#ignored-' + ident).addClass('unignored');
540 $('#ignored-' + ident).removeClass('ignored');
541 $('#ignore-' + ident).removeClass('hidden');
542 $('#unignore-' + ident).addClass('hidden');
544 $('#like-rotator-' + ident).hide();
548 function getPosition(e) {
549 var cursor = {x:0, y:0};
550 if ( e.pageX || e.pageY ) {
555 if( e.clientX || e.clientY ) {
556 cursor.x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
557 cursor.y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
569 var lockvisible = false;
571 function lockview(event,id) {
572 event = event || window.event;
573 cursor = getPosition(event);
579 $.get('lockview/' + id, function(data) {
580 $('#panel').html(data);
581 $('#panel').css({ 'left': cursor.x + 5 , 'top': cursor.y + 5});
587 function lockviewhide() {
592 function post_comment(id) {
595 $('body').css('cursor', 'wait');
596 $("#comment-preview-inp-" + id).val("0");
599 $("#comment-edit-form-" + id).serialize(),
602 $("#comment-edit-wrapper-" + id).hide();
603 $("#comment-edit-text-" + id).val('');
604 var tarea = document.getElementById("comment-edit-text-" + id);
606 commentClose(tarea,id);
607 if(timer) clearTimeout(timer);
608 timer = setTimeout(NavUpdate,10);
612 window.location.href=data.reload;
621 function preview_comment(id) {
622 $("#comment-preview-inp-" + id).val("1");
623 $("#comment-edit-preview-" + id).show();
626 $("#comment-edit-form-" + id).serialize(),
629 $("#comment-edit-preview-" + id).html(data.preview);
630 $("#comment-edit-preview-" + id + " a").click(function() { return false; });
640 function showHideComments(id) {
641 if( $("#collapsed-comments-" + id).is(":visible")) {
642 $("#collapsed-comments-" + id).hide();
643 $("#hide-comments-" + id).html(window.showMore);
646 $("#collapsed-comments-" + id).show();
647 $("#hide-comments-" + id).html(window.showFewer);
653 function preview_post() {
654 $("#jot-preview").val("1");
655 $("#jot-preview-content").show();
656 tinyMCE.triggerSave();
659 $("#profile-jot-form").serialize(),
662 $("#jot-preview-content").html(data.preview);
663 $("#jot-preview-content" + " a").click(function() { return false; });
668 $("#jot-preview").val("0");
674 // unpause auto reloads if they are currently stopped
677 $('#pause').html('');
680 // load more network content (used for infinite scroll)
681 function loadScrollContent() {
682 if (lockLoadContent) return;
683 lockLoadContent = true;
685 $("#scroll-loader").fadeIn('normal');
687 // the page number to load is one higher than the actual
689 infinite_scroll.pageno+=1;
691 // get the raw content from the next page and insert this content
692 // right before "#conversation-end"
693 $.get('network?mode=raw' + infinite_scroll.reload_uri + '&page=' + infinite_scroll.pageno, function(data) {
694 $("#scroll-loader").hide();
695 if ($(data).length > 0) {
696 $(data).insertBefore('#conversation-end');
697 lockLoadContent = false;
699 $("#scroll-end").fadeIn('normal');
705 // Converts the binary representation of data to hex
708 // discuss at: http://phpjs.org/functions/bin2hex
709 // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
710 // + bugfixed by: Onno Marsman
711 // + bugfixed by: Linuxworld
712 // * example 1: bin2hex('Kev');
713 // * returns 1: '4b6576'
714 // * example 2: bin2hex(String.fromCharCode(0x00));
716 var v,i, f = 0, a = [];
720 for (i = 0; i<f; i++) {
721 a[i] = s.charCodeAt(i).toString(16).replace(/^([\da-f])$/,"0$1");
727 function groupChangeMember(gid, cid, sec_token) {
728 $('body .fakelink').css('cursor', 'wait');
729 $.get('group/' + gid + '/' + cid + "?t=" + sec_token, function(data) {
730 $('#group-update-wrapper').html(data);
731 $('body .fakelink').css('cursor', 'auto');
735 function profChangeMember(gid,cid) {
736 $('body .fakelink').css('cursor', 'wait');
737 $.get('profperm/' + gid + '/' + cid, function(data) {
738 $('#prof-update-wrapper').html(data);
739 $('body .fakelink').css('cursor', 'auto');
743 function contactgroupChangeMember(gid,cid) {
744 $('body').css('cursor', 'wait');
745 $.get('contactgroup/' + gid + '/' + cid, function(data) {
746 $('body').css('cursor', 'auto');
751 function checkboxhighlight(box) {
752 if($(box).is(':checked')) {
753 $(box).addClass('checkeditem');
756 $(box).removeClass('checkeditem');
760 function notifyMarkAll() {
761 $.get('notify/mark/all', function(data) {
762 if(timer) clearTimeout(timer);
763 timer = setTimeout(NavUpdate,1000);
769 // code from http://www.tinymce.com/wiki.php/How-to_implement_a_custom_file_browser
770 function fcFileBrowser (field_name, url, type, win) {
771 /* TODO: If you work with sessions in PHP and your client doesn't accept cookies you might need to carry
772 the session name and session ID in the request string (can look like this: "?PHPSESSID=88p0n70s9dsknra96qhuk6etm5").
773 These lines of code extract the necessary parameters and add them back to the filebrowser URL again. */
776 var cmsURL = baseurl+"/fbrowser/"+type+"/";
778 tinyMCE.activeEditor.windowManager.open({
780 title : 'File Browser',
781 width : 420, // Your dimensions may differ - toy around with them!
784 inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin!
785 close_previous : "no"
793 function setupFieldRichtext(){
796 mode : "specific_textareas",
797 editor_selector: "fieldRichtext",
798 plugins : "bbcode,paste, inlinepopups",
799 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
800 theme_advanced_buttons2 : "",
801 theme_advanced_buttons3 : "",
802 theme_advanced_toolbar_location : "top",
803 theme_advanced_toolbar_align : "center",
804 theme_advanced_blockformats : "blockquote,code",
805 theme_advanced_resizing : true,
806 paste_text_sticky : true,
807 entity_encoding : "raw",
808 add_unload_trigger : false,
809 remove_linebreaks : false,
810 //force_p_newlines : false,
811 //force_br_newlines : true,
812 forced_root_block : 'div',
814 content_css: baseurl+"/view/custom_tinymce.css",
815 theme_advanced_path : false,
816 file_browser_callback : "fcFileBrowser",
822 * sprintf in javascript
823 * "{0} and {1}".format('zero','uno');
825 String.prototype.format = function() {
826 var formatted = this;
827 for (var i = 0; i < arguments.length; i++) {
828 var regexp = new RegExp('\\{'+i+'\\}', 'gi');
829 formatted = formatted.replace(regexp, arguments[i]);
834 Array.prototype.remove = function(item) {
835 to=undefined; from=this.indexOf(item);
836 var rest = this.slice((to || from) + 1 || this.length);
837 this.length = from < 0 ? this.length + from : from;
838 return this.push.apply(this, rest);
841 function previewTheme(elm) {
842 theme = $(elm).val();
843 $.getJSON('pretheme?f=&theme=' + theme,function(data) {
844 $('#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>');
849 // notification permission settings in localstorage
850 // set by settings page
851 function getNotificationPermission() {
852 if (window["Notification"] === undefined) {
855 if (Notification.permission === 'granted') {
856 var val = localStorage.getItem('notification-permissions');
857 if (val === null) return 'denied';
860 return Notification.permission;
865 * Show a dialog loaded from an url
866 * By defaults this load the url in an iframe in colorbox
867 * Themes can overwrite `show()` function to personalize it
874 * @return object colorbox
876 show : function (url) {
877 var size = Dialog._get_size();
878 return $.colorbox({href: url, iframe:true,innerWidth: size.width+'px',innerHeight: size.height+'px'})
882 * Show the Image browser dialog
885 * @param string id (optional)
888 * The name will be used to build the event name
889 * fired by image browser dialog when the user select
890 * an image. The optional id will be passed as argument
891 * to the event handler
893 doImageBrowser : function (name, id) {
894 var url = Dialog._get_url("image",name,id);
895 return Dialog.show(url);
899 * Show the File browser dialog
902 * @param string id (optional)
905 * The name will be used to build the event name
906 * fired by file browser dialog when the user select
907 * a file. The optional id will be passed as argument
908 * to the event handler
910 doFileBrowser : function (name, id) {
911 var url = Dialog._get_url("file",name,id);
912 return Dialog.show(url);
915 _get_url : function(type, name, id) {
917 if (id !== undefined) hash = hash + "-" + id;
918 return baseurl + "/fbrowser/"+type+"/?mode=minimal#"+hash;
921 _get_size: function() {
923 width: window.innerWidth-50,
924 height: window.innerHeight-100