Last active
August 29, 2015 14:08
-
-
Save kawanet/75779a3417e1514fe691 to your computer and use it in GitHub Desktop.
SUUMO の検索結果画面の価格欄に坪単価を追記するブックマークレット用JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <a href="javascript:(function(){if (location.host != 'suumo.jp') {location.href = 'http://suumo.jp';return;}$('.property_unit').each(function(idx, div) {var m,p,q,r,s,t,u,v;m = {};$(div).find('dt').each(function(idx, dt) {$dt = $(dt);m[$dt.text()] = $dt.parent().find('dd');});t = function($e) {return $e.text().replace(/[\s\r\n]+/g, '').replace(/^\D+/, '').replace(/[^\d\.\,].*$/, '');};p = m['販売価格'] || m['賃料'];s = m['専有面積'] || m['建物面積'];r = t(p) / t(s) * 3.3;u = (r > 10) ? (Math.round(r*10)/10 + '万') : Math.round(r*10000);q = p.find('span:first') || p;q.append('(' + u + '円/坪)');});})()">Suumo</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (location.host != 'suumo.jp') { | |
| location.href = 'http://suumo.jp'; | |
| return; | |
| } | |
| $('.property_unit').each(function(idx, div) { | |
| var m,p,q,r,s,t,u,v; | |
| m = {}; | |
| $(div).find('dt').each(function(idx, dt) { | |
| $dt = $(dt); | |
| m[$dt.text()] = $dt.parent().find('dd'); | |
| }); | |
| t = function($e) { | |
| return $e.text().replace(/[\s\r\n]+/g, '').replace(/^\D+/, '').replace(/[^\d\.\,].*$/, ''); | |
| }; | |
| p = m['販売価格'] || m['賃料']; | |
| s = m['専有面積'] || m['建物面積']; | |
| r = t(p) / t(s) * 3.3; | |
| u = (r > 10) ? (Math.round(r*10)/10 + '万') : Math.round(r*10000); | |
| q = p.find('span:first') || p; | |
| q.append('(' + u + '円/坪)'); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment