/[Frey]/trunk/lib/Frey/Bookmarklet.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/lib/Frey/Bookmarklet.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 455 - (show annotations)
Wed Nov 19 15:28:23 2008 UTC (15 years, 5 months ago) by dpavlin
File size: 1774 byte(s)
rename invocable events with prefix as_ with fallback in Frey::Web

This started with brute-force rename using:

  perl -p -i -n -e 's/sub markup/sub as_markup/'  `grep -lr 'sub markup' lib t`
  perl -p -i -n -e 's/sub data/sub as_data/'      `grep -lr 'sub data' lib t`
  perl -p -i -n -e 's/sub sponge/sub as_sponge/'  `grep -lr 'sub sponge' lib t`

  perl -p -i -n -e 's/->markup/->as_markup/'      `grep -lr -- '->markup' lib t`
  perl -p -i -n -e 's/->data/->as_data/'          `grep -lr -- '->data' lib t`
  perl -p -i -n -e 's/->sponge/->as_sponge/'      `grep -lr -- '->sponge' lib t`

  perl -p -i -n -e 's!/markup!/as_markup!'        `grep -lr -- '/markup' lib t etc`
  perl -p -i -n -e 's!/data!/as_data!'            `grep -lr -- '/data' lib t etc`
  perl -p -i -n -e 's!/sponge!/as_sponge!'        `grep -lr -- '/sponge' lib t etc`

1 package Frey::Bookmarklet;
2 use Moose;
3
4 =head1 NAME
5
6 Frey::Bookmarklet - provide bookmarklets for developers
7
8 =head2 SEE ALSO
9
10 L<http://slayeroffice.com/tools/modi/v2.0/modi_help.html>
11
12 =cut
13
14 extends 'Frey';
15 with 'Frey::Web';
16
17 use File::Slurp;
18
19 sub as_markup {
20 my $self = shift;
21
22 my $js = read_file( 'static/xpath.js' );
23 $js =~ s{//.*}{}gm; # remove comments so that compaction below doesn't screw code
24 $js =~ s/\s\s+/ /gs;
25
26 my $html = qq|
27 <ul>
28 <li>Inspectors</li>
29 <ul>
30 <li><a href="javascript:void($js);">xpath</a> (click again to inspect any element)</li>
31 <li><a href="javascript:prefFile='';void(z=document.body.appendChild(document.createElement('script')));void(z.language='javascript');void(z.type='text/javascript');void(z.src='http://slayeroffice.com/tools/modi/v2.0/modi_v2.0.js');void(z.id='modi');">MODIv2</a></li>
32 </ul>
33 <li>Frames management</li>
34 <ul>
35 <li><a href="javascript:f='';for(x=0;x<window.frames.length;x++){f+=x+':'+window.frames[x].name+'\\n';};d=prompt('Frame?\\n'+f,'');if (!d) { d=0 };window.location=window.frames[d].location;">x</a> close frame (with alert selector)</li>
36 <li><a href="javascript:document.write('<HTML><HEAD></HEAD><FRAMESET ROWS=\\'50%,*\\'><FRAME SRC=' + location.href + ' name=left><FRAME SRC=' + location.href + ' name=right></FRAMESET></HTML>')">h</a> horizontal split</li>
37 <li><a href="javascript:document.write('<HTML><HEAD></HEAD><FRAMESET COLS=\\'50%,*\\'><FRAME SRC=' + location.href + ' name=top><FRAME SRC=' + location.href + ' name=bottom></FRAMESET></HTML>')">v</a> vertical split</li>
38 <!--
39 <li><a href=""></a></li>
40 -->
41 </ul>
42 </ul>
43 |;
44
45 return $self->page(
46 title => 'Bookmarklets for developers',
47 body => $html,
48 ) if $self->can('page');
49
50 return $html;
51 }
52
53 1;

  ViewVC Help
Powered by ViewVC 1.1.26