ubbparser 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ubbparser.rb +8 -2
- metadata +1 -1
data/lib/ubbparser.rb
CHANGED
@@ -234,8 +234,14 @@ module UBBParser
|
|
234
234
|
id = "ubb-email-" + SecureRandom.hex(16)
|
235
235
|
|
236
236
|
# Some generic javascript so every browser can parse this (instantly), regardless of used framework
|
237
|
-
|
238
|
-
|
237
|
+
if (inner_text == email)
|
238
|
+
title = "Protected email address"
|
239
|
+
js_title = "email"
|
240
|
+
else
|
241
|
+
title = inner_text
|
242
|
+
js_title = "\"#{inner_text}\""
|
243
|
+
end
|
244
|
+
script = "<script type='text/javascript'>obj=document.getElementById(\"#{id}\");email=obj.getAttribute(\"data-username\")+\"@\"+obj.getAttribute(\"data-domain\");obj.href=\"mailto:\"+email;obj.innerHTML=#{js_title}</script>";
|
239
245
|
result = "<a id='#{id}' class='#{parse_options[:class_email].to_s.strip}' href='#' data-username='#{username}' data-domain='#{domain}'>#{title}</a>#{script}"
|
240
246
|
end
|
241
247
|
return result
|