/[drupal]/contributions/modules/bueditor/library/bue.find.js
ViewVC logotype

Diff of /contributions/modules/bueditor/library/bue.find.js

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

revision 1.4, Wed Oct 7 23:10:37 2009 UTC revision 1.4.2.1, Mon Nov 9 21:59:31 2009 UTC
# Line 29  E.find = function (str, mc, re) { Line 29  E.find = function (str, mc, re) {
29    
30  //replace str1 with str2.  //replace str1 with str2.
31  E.replace = function(str1, str2, mc, re) {  E.replace = function(str1, str2, mc, re) {
32    var E = this, s = E.find(str1, mc, re).getSelection();    var E = this, s = E.getSelection(), rgx = new RegExp('^'+ (re ? str1 : BUE.regesc(str1)) +'$', mc ? '' : 'i');
33    var rgx = new RegExp('^'+ (re ? str1 : BUE.regesc(str1)) +'$', mc ? '' : 'i');    var found = s && s.search(rgx) == 0 || (s = E.find(str1, mc, re).getSelection()) && s.search(rgx) == 0;
34    if (s && s.search(rgx) == 0 && confirm(Drupal.t('Replace this occurance of "!text"?', {'!text': s}))) {    if (found && confirm(Drupal.t('Replace this occurance of "!text"?', {'!text': s}))) {
35      str2 = re ? s.replace(new RegExp(str1, 'g' + (mc ? '' : 'i')), str2) : str2;      str2 = re ? s.replace(new RegExp(str1, 'g' + (mc ? '' : 'i')), str2) : str2;
36      E.replaceSelection(str2);      E.replaceSelection(str2);
37    }    }
# Line 59  E.scrollTo = function(index) { Line 59  E.scrollTo = function(index) {
59  };  };
60    
61  //open Find & Replace form.  //open Find & Replace form.
62  E.frForm = function(op, mc, re) {  E.frForm = function(rp, mc, re, title) {
63    var el = FRF().elements, rp = op == 'replace';    var el = FRF().elements;
64    BUE.frPop.open(rp ? Drupal.t('Find & Replace') : Drupal.t('Search'));    BUE.frPop.open(title || (rp ? Drupal.t('Find & Replace') : Drupal.t('Search')));
65    $(el.mc.parentNode)[mc ? 'show' : 'hide']();    $(el.mc.parentNode)[mc ? 'show' : 'hide']();
66    $(el.re.parentNode)[re ? 'show' : 'hide']();    $(el.re.parentNode)[re ? 'show' : 'hide']();
67    $([el.rp.parentNode, el.rpb, el.rab])[rp ? 'show' : 'hide']();    $([el.rp.parentNode, el.rpb, el.rab])[rp ? 'show' : 'hide']();
   $(el.fnb)[rp ? 'hide' : 'show']();  
68    el.fn.focus();    el.fn.focus();
69    return this;    return this;
70  };  };
# Line 85  E.frSubmit = function(B) { Line 84  E.frSubmit = function(B) {
84      case 'rpb': E.replace(fn, rp, mc, re); break;//replace      case 'rpb': E.replace(fn, rp, mc, re); break;//replace
85      case 'rab': E.replaceAll(fn, rp, mc, re); break;//replace all      case 'rab': E.replaceAll(fn, rp, mc, re); break;//replace all
86    }    }
87    return E.focus();    return E;
88  };  };
89    
90  //shortcuts  //shortcuts

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.4.2.1

  ViewVC Help
Powered by ViewVC 1.1.2