/[drupal]/contributions/modules/img_assist/img_assist.js
ViewVC logotype

Contents of /contributions/modules/img_assist/img_assist.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.8 - (show annotations) (download) (as text)
Tue Jul 22 23:07:44 2008 UTC (16 months ago) by sun
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +29 -151 lines
File MIME type: text/javascript
#246385 by smk-ka, zoo33, sun: Fixed teaser splitter, separated popup JS/CSS.
1 /* $Id: img_assist.js,v 1.7 2008/07/18 22:58:09 sun Exp $ */
2
3 Drupal.behaviors.img_assist = function(context) {
4 $('textarea.img_assist:not(.img_assist-processed)', context).each(function() {
5 // Drupal's teaser behavior is a destructive one and needs to be run first.
6 if ($(this).is('textarea.teaser:not(.teaser-processed)')) {
7 Drupal.behaviors.teaser(context);
8 }
9 $(this).addClass('img_assist-processed').parent().append(Drupal.theme('img_assist_link', this));
10 });
11 }
12
13 Drupal.theme.prototype.img_assist_link = function(el) {
14 var html = '<div class="img_assist-button">', link = Drupal.t('Add image');
15 if (Drupal.settings.img_assist.link == 'icon') {
16 link = '<img src="'+ Drupal.settings.basePath + Drupal.settings.img_assist.icon +'" alt="'+ link +'" title="'+ link +'" />';
17 }
18 html += '<a href="'+ Drupal.settings.basePath +'index.php?q=img_assist/load/textarea&textarea='+ el.name +'" class="img_assist-link" id="img_assist-link-'+ el.id +'" title="'+ Drupal.t('Click here to add images') +'" onclick="window.open(this.href, \'img_assist_link\', \'width=600,height=350,scrollbars=yes,status=yes,resizable=yes,toolbar=no,menubar=no\'); return false;">'+ link +'</a>';
19 html += '</div>';
20 return html;
21 }
22
23 function launch_popup(nid, mw, mh) {
24 var ox = mw;
25 var oy = mh;
26 if((ox>=screen.width) || (oy>=screen.height)) {
27 var ox = screen.width-150;
28 var oy = screen.height-150;
29 var winx = (screen.width / 2)-(ox / 2);
30 var winy = (screen.height / 2)-(oy / 2);
31 var use_scrollbars = 1;
32 }
33 else {
34 var winx = (screen.width / 2)-(ox / 2);
35 var winy = (screen.height / 2)-(oy / 2);
36 var use_scrollbars = 0;
37 }
38 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');
39 }
40

  ViewVC Help
Powered by ViewVC 1.1.2