jquery_cheats 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +6 -8
- data/jquery_cheats.gemspec +1 -1
- data/lib/jquery_cheats.rb +26 -3
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -15,15 +15,15 @@ However, if you choose this version it may not work. For the github version use
|
|
15
15
|
|
16
16
|
gem 'jquery_cheats',:git=>"git://github.com/plowdawg/jquery_cheats.git"
|
17
17
|
|
18
|
-
==
|
18
|
+
==Usage VERSION >= 1.1.0
|
19
19
|
|
20
|
-
As of version 1.0.0 a railtie was introduced loading methods directly into ActionView
|
21
|
-
|
22
|
-
syntax just because it is much shorter. Version 1.0.0 still only has one method but now
|
23
|
-
is called just by:
|
20
|
+
As of version 1.0.0 a railtie was introduced loading methods directly into ActionView
|
21
|
+
you can call the two methods now by:
|
24
22
|
|
25
23
|
mouseoverimage("/path/to/image1.png","/path/to/image1-hover.png")
|
26
24
|
|
25
|
+
submitimage("/path/to/image","Alternate Text")
|
26
|
+
|
27
27
|
==Usage VERSION < 1.0.0
|
28
28
|
|
29
29
|
As of the current version there is only one available method, future versions will
|
@@ -35,6 +35,4 @@ JQueryCheats::HoverImage.mouseoverimage("/path/to/image1.jpg","/path/to/hover/im
|
|
35
35
|
|
36
36
|
===Future Speculation
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
mouseoverimage("image1.jpg","image2.jpg)
|
38
|
+
Future move from .rdoc to .md
|
data/jquery_cheats.gemspec
CHANGED
data/lib/jquery_cheats.rb
CHANGED
@@ -6,9 +6,32 @@ module JQueryCheats
|
|
6
6
|
#class << self
|
7
7
|
|
8
8
|
def mouseoverimage(initimage,hoverimage)
|
9
|
-
|
10
|
-
|
11
|
-
return
|
9
|
+
cheats_image_tag =""
|
10
|
+
cheats_image_tag = "<img src=\"#{initimage}\" alt=\"image\" onmouseover=\"$(this).attr('src','#{hoverimage}')\" onmouseout=\"$(this).attr('src','#{initimage}')\">"
|
11
|
+
return cheats_image_tag.html_safe
|
12
|
+
end
|
13
|
+
|
14
|
+
def submitimage(imagepath,alt="Image Tag")
|
15
|
+
button_tag = "<a href=\"#\" onclick=\"$('form').submit(); return false;\">
|
16
|
+
<img src=\"#{imagepath}\" alt=\"#{alt}\"></a>".html_safe
|
17
|
+
button_tag += "<script type=\"text/javascript\">
|
18
|
+
$(document).ready(function(){
|
19
|
+
$('html').keypress(function(e){
|
20
|
+
if(e.which == 13){
|
21
|
+
$('form').submit();
|
22
|
+
return false;
|
23
|
+
}
|
24
|
+
});
|
25
|
+
});</script>".html_safe
|
26
|
+
return button_tag
|
27
|
+
end
|
28
|
+
|
29
|
+
def simplemolink(imagepath,link)
|
30
|
+
hover_arry = imagepath.split('.')
|
31
|
+
extension = hover_arry.pop
|
32
|
+
newpath = hover_arry.join
|
33
|
+
newlink = "<a href=\"#{link}\">#{self.mouseoverimage(imagepath,newpath+"-hover."+extension)}</a>".html_safe
|
34
|
+
return newlink
|
12
35
|
end
|
13
36
|
|
14
37
|
def initialize()
|