/* $Id: img_assist.js,v 1.6.4.2 2008/07/22 23:08:13 sun Exp $ */ Drupal.behaviors.img_assist = function(context) { $('textarea.img_assist:not(.img_assist-processed)', context).each(function() { // Drupal's teaser behavior is a destructive one and needs to be run first. if ($(this).is('textarea.teaser:not(.teaser-processed)')) { Drupal.behaviors.teaser(context); } $(this).addClass('img_assist-processed').parent().append(Drupal.theme('img_assist_link', this)); }); } Drupal.theme.prototype.img_assist_link = function(el) { var html = '
', link = Drupal.t('Add image'); if (Drupal.settings.img_assist.link == 'icon') { link = ''+ link +''; } html += ''+ link +''; html += '
'; return html; } function launch_popup(nid, mw, mh) { var ox = mw; var oy = mh; if((ox>=screen.width) || (oy>=screen.height)) { var ox = screen.width-150; var oy = screen.height-150; var winx = (screen.width / 2)-(ox / 2); var winy = (screen.height / 2)-(oy / 2); var use_scrollbars = 1; } else { var winx = (screen.width / 2)-(ox / 2); var winy = (screen.height / 2)-(oy / 2); var use_scrollbars = 0; } var win = window.open(Drupal.settings.basePath + 'index.php?q=img_assist/popup/' + nid, 'imagev', 'height='+oy+'-10,width='+ox+',top='+winy+',left='+winx+',scrollbars='+use_scrollbars+',resizable'); }