Google Mapsで住所から緯度経度 / マーカーから緯度経度&住所を求める

タイトル通りの内容。

地図を登録させるフォームつくる機会があったんだけど、
住所検索だけだと同一番地内などで微妙に位置ずれする。

なので、マーカーで緯度/経度を修正して、
投稿時には
・入力した住所
・マーカーの緯度/経度
をもらってGoogle Mapsを表示させればいいんじゃないかなという話。

こんな感じ。

http://dl.dropbox.com/u/131731/sample/googlemaps-address_marker.html

2011/11/24:ちょっと改良して、ドラッグ時にパーマリンク表示するようにした。

[JavaScript] Google Mapsで住所から緯度経度 / マーカーから緯度経度&住所を求める

タイトル通りの内容。 地図を登録させるフォームつくる機会があったんだけど、 住所検索だけだと同一番地内などで微妙に位置ずれする。 なので、マーカーで緯度/経度を修正して、 投稿時には ・入力した住所 ・マーカーの緯度/経度 をもらってGoogle Mapsを表示させればいいんじゃないかなという話。 こんな感じ。 http://dl.dropbox.com/u/131731/sample/googlemaps-address_marker.html 2011/11/24:ちょっと改良して、ドラッグ時にパ …

fjm: ☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆ ( #particlulu live at http://ustre.am/yMnp)

fjm: ☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆☼⚡☂☁☃☆ ( #particlulu live at http://ustre.am/yMnp)

fjm: ☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕ ( #particlulu live at http://ustre.am/yMnp)

fjm: ☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕☕ ( #particlulu live at http://ustre.am/yMnp)

カレンダーの日本語表記の日付を英語表示にする(jQueryで無理やり)

WordPress

<?php get_calendar(); ?>

で表示されるカレンダーを英語表記にするやつ。
単に文字列を置き換えているだけだけど、
jQuery読み込んでいること前提で。

<script type="text/javascript">
$(document).ready(function(){

	//yyyy年mm月の置換
	$('#wp-calendar caption').each(function() {
		var text = $(this).text().split("年");
		//[Month. Year]
		$(this).text(month_en(text[1]) + '. ' + text[0]);
	});

	//曜日の置換
	$('#wp-calendar th').each(function() {
		if ($(this).text() == "日") { $(this).addClass('sunday'); } 
		if ($(this).text() == "土") { $(this).addClass('saturday'); }
		$(this).text(day_en($(this).text()));
	});

	//前月の置換
	$('#wp-calendar #prev a').each(function() {
		var text = $(this).text().split(" ");
		//[< Month]
		$(this).text('< ' + month_en(text[1]));
	});

	//次月の置換
	$('#wp-calendar #next a').each(function() {
		var text = $(this).text().split(" ");
		//[Month >]
		$(this).text(month_en(text[0]) + ' >');
	});

	function day_en($text) {
		switch ($text) {
			case '日':  $text = 'S'; break;
			case '月':  $text = 'M'; break;
			case '火':  $text = 'T'; break;
			case '水':  $text = 'W'; break;
			case '木': $text = 'T'; break;
			case '金': $text = 'F'; break;
			case '土': $text = 'S'; break;
		}
		return $text;
	}

	function month_en($text) {
		switch ($text) {
			case '12月': $text = 'Dec'; break;
			case '11月': $text = 'Nov'; break;
			case '10月': $text = 'Oct'; break;
			case '9月': $text = 'Sep'; break;
			case '8月': $text = 'Aug'; break;
			case '7月': $text = 'Jul'; break;
			case '6月': $text = 'Jun'; break;
			case '5月': $text = 'May'; break;
			case '4月': $text = 'Apr'; break;
			case '3月': $text = 'Mar'; break;
			case '2月': $text = 'Feb'; break;
			case '1月': $text = 'Jan'; break;
		}
		return $text;
	}

});
</script>