OSDN Git Service

direct tel: link on iPhone
authorishikawa <ishikawa@180c8125-5b33-4295-ad04-72a68a15b4cc>
Wed, 15 Jul 2009 12:29:51 +0000 (12:29 +0000)
committerishikawa <ishikawa@180c8125-5b33-4295-ad04-72a68a15b4cc>
Wed, 15 Jul 2009 12:29:51 +0000 (12:29 +0000)
lib/plugins/20phone

index 5545d1e..5475a5f 100644 (file)
@@ -1,7 +1,7 @@
 # -*- mode: perl; coding: utf-8 -*-
 # keitairc/lib/plugins/20phone
 # 電話番号
-# $Id: 20phone,v 1.9 2009-07-12 02:54:22 ishikawa Exp $
+# $Id: 20phone,v 1.10 2009-07-15 12:29:51 ishikawa Exp $
 # $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/20phone,v $
 
 # The line number (1 incremented) and filename below must be
@@ -14,11 +14,20 @@ $plugin = {
        message_replace_regexp => '\b(0\d{1,3})([-(]?)(\d{2,4})([-)]?)(\d{4})\b',
        message_replace_imprementation => sub {
                my ($request, $session_id, $p1, $p2, $p3, $p4, $p5) = @_;
-               sprintf('<a target="_self" class="inline" href="%s%s/phone/%s%s%s">%s%s%s%s%s</a>',
-                       $::cf->web_root(),
-                       $session_id,
-                       $p1, $p3, $p5,
-                       $p1, $p2, $p3, $p4, $p5);
+               my $ci = new Keitairc::ClientInfo($request);
+               if ($ci->is_ipod()) {
+                       # iPhone では ダイレクトに phone to にして、
+                       # アプリ側処理に任せる
+                       sprintf('<a target="_self" class="inline" href="tel:%s%s%s">%s%s%s%s%s</a>',
+                               $p1, $p3, $p5,
+                               $p1, $p2, $p3, $p4, $p5);
+               } else {
+                       sprintf('<a target="_self" class="inline" href="%s%s/phone/%s%s%s">%s%s%s%s%s</a>',
+                               $::cf->web_root(),
+                               $session_id,
+                               $p1, $p3, $p5,
+                               $p1, $p2, $p3, $p4, $p5);
+               }
        },
 
        action_imprementation => sub {