ol li {margin-bottom:10px;}
  • APIツールは、インターネット上で無料で公開されている有用な情報を取得し、 カスタマイズして自サイトで使用可能にしたツール集です。 したがって、情報に課金するものではなく、簡単に利用する為のインターフェースの料金です。
  • 情報提供もとのサービスが停止されると、APIも利用できなくなります。 弊社が永久に動作を保障する物では有りません。予めご了承ください。
  • 本機能の使用にはjQueryとsystem.jsも必要ですので、最低でもこれだけはインクルードしなければなりません。
    <link rel=\"stylesheet\" href=\"/jquery/themes/start/jquery-ui.css\" type=\"text/css\" />
    <script type=\"text/javascript\" src=\"/jquery/js/jquery-1.6.4.min.js\"></script>
    <script type=\"text/javascript\" src=\"/jquery/js/jquery-ui-1.8.5.custom.min.js\"></script>
    <script type=\"text/javascript\" src=\"/trycms/system.js\"></script>
  • それぞれのガジェットはSSIでの挿入も可能ですが、基本的にはAjaxで挿入します。
世界時計
ガジェットの挿入
  1. ガジェットを挿入する位置にエレメントを設定します。
    <div id=\"worldclock\">世界時計を読み込み中</div>
    この例では<div>を使用していますが、もちろん他のタグでも結構です。
    idは、ページ内で重複しないユニークな名前を付けます。
  2. ページの最後に、世界時計を呼び出すAjaxを記述します。
    <script type=\"text/javascript\">
    getAjaxText('/trycms/ajax.php?cmd=clock&w=120&ajax=1', 'analog_clock', setdefaultzone);
    function setdefaultzone() { set_timezone(0, '東京'); }
    </script>
地域の天気
ガジェットの挿入 サイトに訪問していただいたお客様の地域の天気予報を表示します。 サイト管理者や、サーバの有る地域ではなく、あくまでも現在ページをご覧いただいていますお客様の地域です。 サンプル
  1. ガジェットを挿入する位置にエレメントを設定します。
    <div id=\"weather_inc\">地域の天気を読み込み中</div>
    この例では<div>を使用していますが、もちろん他のタグでも結構です。
    idは、ページ内で重複しないユニークな名前を付けます。
  2. ページの最後に、地域の天気を呼び出すjavascriptを記述します。</body>の直前で結構です。
    <script type=\"text/javascript\">
    getAjaxText('/trycms/ajax.php?cmd=setweather', 'weather_inc');
    </script>
位置情報
ガジェットの挿入 サイトに訪問していただいたお客様の位置情報を表示します。 サイト管理者や、サーバの有る地域ではなく、あくまでも現在ページをご覧いただいていますお客様の地域です。 サンプル
  1. ガジェットを挿入する位置にエレメントを設定します。
    <div id=\"location_inc\">位置情報を読み込み中</div>
    この例では<div>を使用していますが、もちろん他のタグでも結構です。
    idは、ページ内で重複しないユニークな名前を付けます。
  2. ページの最後に、位置情報を呼び出すjavascriptを記述します。</body>の直前で結構です。
    <script type=\"text/javascript\">
    getAjaxText('/trycms/ajax.php?cmd=getlocation', 'location_inc');
    </script>
星占い
ガジェットの挿入 JugemKey原宿占い館 塔里木監修の星占いを表示します。 サンプル
  1. ガジェットを挿入する位置にエレメントを設定します。
    <div id=\"divination\">星占いを読み込み中</div>
    この例では<div>を使用していますが、もちろん他のタグでも結構です。
    idは、ページ内で重複しないユニークな名前を付けます。
  2. ページの最後に、星占いを呼び出すAjaxを記述します。</body>の直前で結構です。
    <script type=\"text/javascript\">
    getAjaxText('/trycms/ajax.php?cmd=divination', 'divination');
    </script>
為替情報
ガジェットの挿入
  1. ガジェットを挿入する位置にエレメントを設定します。 サンプル
    <div id=\"currency_inc\">為替情報を読み込み中</div>
    この例では<div>を使用していますが、もちろん他のタグでも結構です。
    idは、ページ内で重複しないユニークな名前を付けます。
  2. ページの最後に、為替情報を呼び出すAjaxを記述します。</body>の直前で結構です。
    <script type=\"text/javascript\">
    getAjaxText('/trycms/ajax.php?cmd=currency', 'currency_inc');
    </script>
翻訳
ガジェットの挿入
  1. ガジェットを挿入する位置にエレメントを設定します。
    <div id=\"translate_inc\">翻訳を読み込み中</div>
    この例では<div>を使用していますが、もちろん他のタグでも結構です。
    idは、ページ内で重複しないユニークな名前を付けます。
  2. ページの最後に、翻訳を呼び出すAjaxを記述します。</body>の直前で結構です。
    <script type=\"text/javascript\">
    getAjaxText('/trycms/ajax.php?cmd=translate', 'translate_inc');
    </script>
1つのガジェットを挿入するだけなら直接ページにAjaxを記述すれば良いのですが、 複数のガジェットを全てのページに挿入するとなると厄介ですので、javascriptを別ファイルにして各ページでインクルードします。
<script type=\"text/javascript\">
getAjaxText('/trycms/ajax.php?cmd=clock&w=120&ajax=1', 'analog_clock', setdefaultzone);
function setdefaultzone() { set_timezone(0, '東京'); }
getAjaxText('/trycms/ajax.php?cmd=getlocation', 'location_inc');
getAjaxText('/trycms/ajax.php?cmd=setweather', 'weather_inc');
getAjaxText('/trycms/ajax.php?cmd=divination', 'divination');
getAjaxText('/trycms/ajax.php?cmd=currency', 'currency_inc');
getAjaxText('/trycms/ajax.php?cmd=translate', 'translate_inc');
</script>
このようなファイルを作成してpageini.js等の名前をつけて保存します。
このファイルを全てのページに最後、</body>の直前でインクルードします。
<script type=\"text/javascript\" src=\"/common/pageini.js\"></script>

弊社マニュアルサイトのようにアコーディオンやタブなどのオブジェクトに挿入する場合は少しスクリプトの工夫が必要ですので、 APIツールや、
Ajaxについてをご参照ください。
閉じる ≪ 戻る $helpbutton
"; $client = new window; $client->name = 'client'; $client->width = '920px;'; $client->display = 'block'; $client->caption = "APIツール設定"; $client->drag = false; $client->resize = false; $client->closebutton = true; $client->closeFunc = ''; $client->smallbutton = true; $client->height = ''; $client->border = false; $client->bgcolor = ''; $client->statusbar = false; $client->bgcolor = ''; $client->date = false; $client->time = false; $client->copy = false; $client->help = $help->$_REQUEST['cmd']; $client->body = $doc; $html .= $client->show(); $javascript = " var previewwin; var selectLine; var imageField; function location_view() { getAjaxText('/trycms/ajax.php?cmd=getlocation', 'alertdialog'); $(function() { $('#alertdialog').dialog({ title: 'バージョン情報',resizable:false,width:240,height:240,modal:true,show:'blind',hide:'blind', buttons: { 閉じる: function() { $(this).dialog('close'); } } }); }); } function weather_view() { $('#alertdialog').css('text-align', 'center'); getAjaxText('/trycms/ajax.php?cmd=setweather', 'alertdialog'); $(function() { $('#alertdialog').dialog({ title: 'バージョン情報',resizable:false,width:200,height:260,modal:true,show:'blind',hide:'blind', buttons: { 閉じる: function() { $(this).dialog('close'); } } }); }); } function divination_view() { getAjaxText('/trycms/ajax.php?cmd=divination', 'alertdialog'); $(function() { $('#alertdialog').dialog({ title: 'バージョン情報',resizable:false,width:220,height:360,modal:true,show:'blind',hide:'blind', buttons: { 閉じる: function() { $(this).dialog('close'); } } }); }); } function currency_view() { getAjaxText('/trycms/ajax.php?cmd=currency', 'alertdialog'); $(function() { $('#alertdialog').dialog({ title: 'バージョン情報',resizable:false,width:200,height:260,modal:true,show:'blind',hide:'blind', buttons: { 閉じる: function() { $(this).dialog('close'); } } }); }); } function show_help() { if ($('#help').css('display') == 'none') { $('#help').css('display', 'block'); document.getElementById('helpimg').src='images/help_open.png'; } else { $('#help').css('display', 'none'); document.getElementById('helpimg').src='images/help_close.png'; } } function setfilename(path) { $('#addr'+selectLine).val(path); } function setimgfilename(path) { $('#'+imageField).val(path); } function windowGoResize() { var h = $(window).height(); document.getElementById('scroolBody').style.height=h-60+'px'; } windowGoResize(); window.onresize=windowGoResize;"; } elseif ($_REQUEST['cmd'] == 'station') { $text = "
キーワードから最寄り駅、インターチェンジを検索します。


"; } elseif ($_REQUEST['cmd'] == 'find_station') { $text = "
【目的地】
"; $text .= "
"; $url = "http://utf.trycms.net/geostation/?mode=". $_REQUEST['mode']. "&word=". $_REQUEST['word']; $xml = simplexml_load_file($url); if ($xml->Status->code == 200) { $text .= "
address $xml->address
郵便番号 $xml->zip
都道府県 $xml->pre
市区町村 $xml->city
緯度 $xml->Lat
経度 $xml->Lon
【"; if ($_REQUEST['mode']) { $text .= "最寄りのインターチェンジ"; $cnt = count($xml->Interchanges); } else { $text .= "最寄り駅"; $cnt = count($xml->Stations); } $text .= "】検索結果 $cnt 件
"; if ($cnt) { for($i = 0; $i < $cnt; $i++) { if ($_REQUEST['mode']) { $text .= "
". $xml->Interchanges[$i]->name. "
路線名 ". $xml->Interchanges[$i]->line. "
緯度 ". $xml->Interchanges[$i]->lat. "
経度 ". $xml->Interchanges[$i]->lon. "
直線距離 ". comma($xml->Interchanges[$i]->len). "m
"; } else { $text .= "
". $xml->Stations[$i]->name. "
沿線 ". $xml->Stations[$i]->line. "
所在地 ". $xml->Stations[$i]->address. "
緯度 ". $xml->Stations[$i]->lat. "
経度 ". $xml->Stations[$i]->lon. "
直線距離 ". comma($xml->Stations[$i]->len). "m
"; } } } } else { $text .= " $url
申し訳有りません。
指定のキーワードで対象が見つかりません。

キーワードには、目的地の名称や、住所を指定できます。
"; } $text .= "
"; } elseif ($_REQUEST['cmd'] == 'setweather') { $url = "http://utf.trycms.net/geoip/geocity.php?ip=". $_SERVER['REMOTE_ADDR']; list($ip,$cnCode,$cnCode3,$cnName,$region,$pre,$city,$jpCode,$Pre,$Lat,$Lon) = split(",", file_get_contents($url)); $time = time(); $text = " "; } elseif ($_REQUEST['cmd'] == 'getlocation') { $url = "http://utf.trycms.net/geoip/geocity.php?ip=". $_SERVER['REMOTE_ADDR']. "&lang=". $_REQUEST['lang']; list($ip,$cnCode,$cnCode3,$cnName,$region,$pre,$city,$jpCode,$Pre,$Lat,$Lon) = split(",", file_get_contents($url)); $text = "
緯度$Lat
経度$Lon
国名コード$cnCode
国名$cnName
各国固有の地域名$pre
都市名$city
"; } elseif ($_REQUEST['cmd'] == 'clock') { $text = "
 
\"\"
\"\"
\"\"
: :
東京 | ロサンゼルス | ニューヨーク | ホノルル | パリ | ローマ | ロンドン"; if (!$_REQUEST['nonall']) { $text .= "
その他、世界の主要都市"; } $text .= "
"; } elseif ($_REQUEST['cmd'] == 'clock_all') { !$_REQUEST['cols'] && $_REQUEST['cols'] = 2; $world = file("timelag.txt"); $max = count($world); $maxrow = ceil($max / $_REQUEST['cols']); $now = jst_time(time(), 7); list($date, $time) = split(" ", $now); list($year, $month, $day) = split("/", $date); list($hou, $min, $sec) = split(":", $time); $text = "
"; $row = $maxrow +1; $i = 1; foreach ($world as $country) { list($city, $lag) = preg_split("/[,\n]/", $country); if ($row > $maxrow) { if ($i != 1) { $text .= "
"; } $text .= " "; $row = 1; } $y = $year; $mon = $month; $d = $day; $h = $hou + $lag; $m = $min; if ($h < 0) { $h += 24; $d--; if ($d < 1) { $mon--; if ($mon < 1) { $mon = 12; $y--; } $dummy = date('y-m-t', strtotime(sprintf("%04d-%02d-01", $y, $mon))); list($y, $mon, $d) = split("-", $dummy); } } $date = sprintf("%02d/%02d %02d:%02d", $mon, $d, $h, $m); $text .= " "; $row++; $i++; } $text .= "
No 都市 時刻 時差
$i $city $date $lag
"; } elseif ($_REQUEST['cmd'] == 'currency') { $Currency = file("currency.txt"); foreach ($Currency as $line) { list($key, $name, $country, $area) = preg_split("/[,\n]/", $line); $currency[$key]->name = $name; $currency[$key]->country = $country; $currency[$key]->area = $area; } $url = "http://api.aoikujira.com/kawase/xml"; $xml = simplexml_load_file($url); $usd = (float) $xml->USD; $eur = (float) $xml->EUR; $text = $xml->update. " 現在
¥". sprintf("%2.2f", 1 / $usd). "-
¥". sprintf("%2.2f", 1 / $eur). "-
"; if (!$_REQUEST['nonall']) { $text .= " その他の通貨"; } } elseif ($_REQUEST['cmd'] == 'currency_all') { $Currency = file("currency.txt"); foreach ($Currency as $line) { list($key, $name, $country, $area) = preg_split("/[,\n]/", $line); $currency[$key]->name = $name; $currency[$key]->country = $country; $currency[$key]->area = $area; } $url = "http://api.aoikujira.com/kawase/xml"; $xml = simplexml_load_file($url); $ary = file_get_contents($url); $Ary = split("\n", $ary); $text = $xml->update. " 現在 "; foreach ($Ary as $line) { if (preg_match("/<(\w{3})>(\d+)/", $line, $m)) { $key = $m[1]; if ((float) $xml->$key > 0) { $val = (float) $xml->$key; $text .= " "; } } } $text .= "
記号 為替レート 名称 地域
$key ¥". sprintf("%2.2f", 1 / $val). "- ". $currency[$key]->name." ". $currency[$key]->country." ". $currency[$key]->area."
"; } elseif ($_REQUEST['cmd'] == 'divination') { $json = new Services_JSON(); list($y, $m, $d) = split("/", jst_time(time(), 5)); $divination = file_get_contents("http://api.jugemkey.jp/api/horoscope/free/$y/$m/$d"); $obj = $json->decode($divination); for($i = 0; $i < 12; $i++) { if ($obj->horoscope->{"$y/$m/$d"}[$i]->rank == 1) break; } $name = $obj->horoscope->{"$y/$m/$d"}[$i]->sign; $Seiza = file("constellation.txt"); $idx = array_values(preg_grep("/$name/", $Seiza)); list($icon, $name1, $name2,$date) = preg_split("/[,\s]/", $idx[0]); $text = "
$y/$m/$d
総合運 第一位 「$name1
$date 生"; if (!$_REQUEST['nonall']) { $text .= "
詳細、その他の星座"; } } elseif ($_REQUEST['cmd'] == 'divination_all') { $Seiza = file("constellation.txt"); $json = new Services_JSON(); list($y, $m, $d) = split("/", jst_time(time(), 5)); $divination = file_get_contents("http://api.jugemkey.jp/api/horoscope/free/$y/$m/$d"); $obj = $json->decode($divination); $text = " "; for($i = 0; $i < 12; $i++) { $j = sprintf("%02d", $i + 1); list($icon, $name1, $name2,$date) = preg_split("/[,\s]/", $Seiza[$i]); $text .= " "; $text .= graph('金運', $obj->horoscope->{"$y/$m/$d"}[$i]->money, "greenbar1000.png"); $text .= graph('仕事運', $obj->horoscope->{"$y/$m/$d"}[$i]->job, "greenbar1000.png"); $text .= graph('恋愛運', $obj->horoscope->{"$y/$m/$d"}[$i]->love, "greenbar1000.png"); $total = ($obj->horoscope->{"$y/$m/$d"}[$i]->money + $obj->horoscope->{"$y/$m/$d"}[$i]->job + $obj->horoscope->{"$y/$m/$d"}[$i]->love + $obj->horoscope->{"$y/$m/$d"}[$i]->total) / 4; $text .= graph('総合運', $total, "graph_bar1000.png"); } $text .= "
". $obj->horoscope->{"$y/$m/$d"}[$i]->sign. " ($date 生)
ランキング ". $obj->horoscope->{"$y/$m/$d"}[$i]->rank. " 位
総評 ". $obj->horoscope->{"$y/$m/$d"}[$i]->content. "
ラッキーカラー ". $obj->horoscope->{"$y/$m/$d"}[$i]->color. "
ラッキーアイテム ". $obj->horoscope->{"$y/$m/$d"}[$i]->item. "
JugemKey 原宿占い館 塔里木
"; } elseif ($_REQUEST['cmd'] == 'translate') { $text = "
日本語(ja)
\"\"
英語(en)

上記テキストボックスに語句を入力してください。 日本語(ja)、英語(en)の相互変換が可能です。
"; } ?>