Created
March 3, 2014 10:37
-
-
Save hrkd/9322399 to your computer and use it in GitHub Desktop.
photoshopの選択範囲から、htmlのmapタグ、areaタグを生成するjsx
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
// JavaScript Document | |
var x1 = activeDocument.selection.bounds[0]; | |
var y1 = activeDocument.selection.bounds[1]; | |
var x2 = activeDocument.selection.bounds[2]; | |
var y2 = activeDocument.selection.bounds[3]; | |
var tmp = x1.toString() + y1.toString() + x2.toString() + y2.toString(); | |
var rect = tmp.split(' px'); | |
prompt('mapタグの生成が完了しました。(座標の始点はスライスではなく、カンバスです。)', '<img src="sample.gif" usemap="#Map" alt="">\n<map name="Map">\n<area href="#" shape="rect" alt="" coords="'+rect[0]+','+rect[1]+','+rect[2]+','+rect[3]+'">\n</map>'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment