ubbparser 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/ubbparser.rb +8 -2
  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
- title = (inner_text == email) ? "protected email address" : inner_text
238
- script = "<script type='text/javascript'>obj=document.getElementById(\"#{id}\");email=obj.getAttribute(\"data-username\")+\"@\"+obj.getAttribute(\"data-domain\");obj.href=\"mailto:\"+email;obj.innerHTML=\"#{title}\"</script>";
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ubbparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: