Skip to content

Commit

Permalink
update package json
Browse files Browse the repository at this point in the history
  • Loading branch information
yiminghe committed May 23, 2013
1 parent 0a2b320 commit 8fa04f4
Show file tree
Hide file tree
Showing 7 changed files with 1,226 additions and 751 deletions.
15 changes: 7 additions & 8 deletions lib/main.js
Expand Up @@ -12,8 +12,7 @@ function my_js_beautify(str) {

function minify(html) {

var idMap = {},
classMap = {},
var classIdMap = {},
idIndex = 0,
base = 97, // a-1
max = 122, // z
Expand All @@ -32,25 +31,25 @@ function minify(html) {

html = html.replace(ID_REG, function (m, v) {
v = v.trim();
return ' id="' + (idMap[v] = idMap[v] || getShortString(idIndex++)) + '"';
return ' id="' + (classIdMap[v] = classIdMap[v] || getShortString(idIndex++)) + '"';
});

html = html.replace(CLASS_REG, function (m, v) {
v = v.trim().split(/\s+/);
var ret = '';
v.forEach(function (a) {
ret += ' ' + (classMap[a] = classMap[a] || getShortString(classIndex++));
ret += ' ' + (classIdMap[a] = classIdMap[a] || getShortString(classIndex++));
});
return ' class="' + ret.trim() + '"';
});

var jsCode = 'CLASS_ID_MAP=' + JSON.stringify(idMap) + ';';
var jsCode = 'CLASS_ID_MAP=' + JSON.stringify(classIdMap) + ';';

var scssCode = '';

for (var p in classMap) {
if (classMap.hasOwnProperty(p)) {
scssCode += '$' + p + ': ' + classMap[p] + '\n';
for (var p in classIdMap) {
if (classIdMap.hasOwnProperty(p)) {
scssCode += '$' + p + ': ' + classIdMap[p] + '\n';
}
}

Expand Down
972 changes: 486 additions & 486 deletions tests/fp-min.html

Large diffs are not rendered by default.

Binary file modified tests/fp-min.html.gz
Binary file not shown.
313 changes: 312 additions & 1 deletion tests/map.js
Expand Up @@ -164,5 +164,316 @@ CLASS_ID_MAP = {
"tanx-a-mm_12852562_1778064_10263233": "fg",
"tanx-a-mm_12852562_1778064_9087844": "fh",
"J_Footer": "fi",
"J_FooterMore": "fj"
"J_FooterMore": "fj",
"sitenav-mobile": "a",
"login-info": "b",
"quick-menu": "c",
"home": "d",
"menu-item": "e",
"menu": "f",
"menu-hd": "g",
"menu-bd": "h",
"menu-bd-panel": "i",
"mytaobao": "j",
"seller-center": "k",
"service": "l",
"cart": "m",
"leftline": "n",
"rightline": "o",
"favorite": "p",
"services": "q",
"last": "r",
"sitenav-guide": "s",
"sitenav-guide-trigger": "t",
"J_GuideToggle": "u",
"sitenav-guide-panel": "v",
"system_notice": "w",
"top-banner": "x",
"layout": "y",
"layout-hd": "z",
"logo": "aa",
"J_DirectPromo": "ab",
"search": "ac",
"search-status-focus": "ad",
"search-triggers": "ae",
"ks-switchable-nav": "af",
"selected": "ag",
"search-fix": "ah",
"search-fix-triggerlt": "ai",
"search-fix-triggerrt": "aj",
"search-panel": "ak",
"ks-switchable-content": "al",
"search-panel-fields": "am",
"search-fix-panellt": "an",
"search-fix-panellb": "ao",
"search-tips": "ap",
"search-hots": "aq",
"h": "ar",
"more": "as",
"more-with-border": "at",
"arrow": "au",
"arrow-rthin": "av",
"nav": "aw",
"nav-special": "ax",
"nav-tmall": "ay",
"nav-juhuasuan": "az",
"nav-3c": "ba",
"nav-super": "bb",
"nav-etao": "bc",
"nav-travel": "bd",
"nav-img": "be",
"nav-star": "bf",
"layout-fp": "bg",
"col-main": "bh",
"product-list": "bi",
"product-list-content": "bj",
"product-header": "bk",
"product-header-title": "bl",
"product-body-services": "bm",
"product-body-live": "bn",
"product-body-communities": "bo",
"product-body-tools": "bp",
"product-body-partners": "bq",
"mainpromo": "br",
"mainpromo-hint": "bs",
"tmall": "bt",
"tmall-interlayer": "bu",
"tmall-interlayer-rotatelist": "bv",
"middle": "bw",
"dot": "bx",
"vertical": "by",
"tmall-interlayer-rotatelist-list": "bz",
"rotate": "ca",
"step": "cb",
"arrow-lthin": "cc",
"tmall-interlayer-title": "cd",
"tmall-slide": "ce",
"tmall-slide-right": "cf",
"tmall-slide-left": "cg",
"tmall-slide-switchable": "ch",
"big-piclist": "ci",
"hot-banner": "cj",
"hot-banner-wrapper": "ck",
"col-sub": "cl",
"notice": "cm",
"tab-hd": "cn",
"tab-nav": "co",
"tab-cur": "cp",
"tab-bd": "cq",
"tab-pal": "cr",
"status": "cs",
"help-guest": "ct",
"hg-regist": "cu",
"hg-login": "cv",
"hg-freeopen": "cw",
"convenience": "cx",
"no-hover": "cy",
"ks-datalazyload": "cz",
"invisible": "da",
"module": "db",
"tbr-env-fp1": "dc",
"tbr-container": "dd",
"tbr-block": "de",
"tbr-control": "df",
"tbr-block-bd": "dg",
"tbr-input": "dh",
"tbr-icon": "di",
"tbr-input-label": "dj",
"tbr-dropdown": "dk",
"tbr-log": "dl",
"tbr-dropdown-label": "dm",
"tbr-result": "dn",
"tbr-block-hd": "do",
"tbr-buy": "dp",
"tbr-btn": "dq",
"tbr-btn-buy": "dr",
"tbr-btn-link": "ds",
"tbr-link": "dt",
"tbr-price": "du",
"tbr-form-buy": "dv",
"new-service-module": "dw",
"new-service-game": "dx",
"new-service-module-container": "dy",
"new-service-hd": "dz",
"J_GameSWTrigger": "ea",
"new-service-bd": "eb",
"new-service-game-item": "ec",
"J_GameSWPanel": "ed",
"ks-datalazyload-custom": "ee",
"tbr-radio": "ef",
"tbr-radio-label": "eg",
"tbr-radio-input": "eh",
"tbr-form-fastbuy": "ei",
"suggest": "ej",
"game-s": "ek",
"select": "el",
"btn": "em",
"ad-link": "en",
"recommend": "eo",
"other": "ep",
"J_tripModuleContainer": "eq",
"clearfix": "er",
"J_switchNav": "es",
"new-service-hd-current": "et",
"new-service-trip": "eu",
"new-service-trip-item": "ev",
"J_switchPanel": "ew",
"new-service-trip-first": "ex",
"new-service-mr15": "ey",
"new-service-trip-condition": "ez",
"label": "fa",
"new-service-trip-hide": "fb",
"new-service-trip-tips": "fc",
"new-service-trip-icon": "fd",
"J_tripGo": "fe",
"new-service-dis": "ff",
"new-service-btn": "fg",
"J_newServiceBtn": "fh",
"new-service-link": "fi",
"J_tripLazy": "fj",
"new-service-datalazyload-custom": "fk",
"new-service-trip-input": "fl",
"dujia-search-form": "fm",
"new-service-trip-mt4": "fn",
"new-service-hide": "fo",
"new-service-trip-go": "fp",
"new-service-trip-travel": "fq",
"new-service-complete-input": "fr",
"new-service-trip-suggest": "fs",
"pay-more": "ft",
"payment": "fu",
"credit": "fv",
"phone": "fw",
"fuel": "fx",
"fine": "fy",
"donate": "fz",
"theme-hot": "ga",
"th-item": "gb",
"th-hot": "gc",
"category": "gd",
"category-hd": "ge",
"category-bd": "gf",
"category-l": "gg",
"category-item": "gh",
"category-item-top": "gi",
"category-virtual": "gj",
"cursor-default": "gk",
"category-baldric": "gl",
"category-jewelry": "gm",
"category-appliances": "gn",
"category-baby": "go",
"category-foods": "gp",
"category-item-bottom": "gq",
"category-entertain": "gr",
"category-r": "gs",
"category-clothes": "gt",
"category-sports": "gu",
"category-digital": "gv",
"category-beauty": "gw",
"category-living": "gx",
"category-dailyuse": "gy",
"category-car": "gz",
"category-special": "ha",
"gg": "hb",
"new-actives": "hc",
"txt-page": "hd",
"prev": "he",
"next": "hf",
"category-sub": "hg",
"recom": "hh",
"category-sub-recom": "hi",
"bd": "hj",
"tab-panel": "hk",
"tab-panel-actively": "hl",
"J_DirectionalBox": "hm",
"item-list": "hn",
"actively-list": "ho",
"item-list-special": "hp",
"tab-panel-hotsale": "hq",
"ad-hotsale": "hr",
"list": "hs",
"tab-panel-special": "ht",
"tab-panel-ms": "hu",
"seckill": "hv",
"seckill-img": "hw",
"seckill-image": "hx",
"seckill-news": "hy",
"seckill-special": "hz",
"overflow": "ia",
"globalshop": "ib",
"globalshop-images": "ic",
"globalshop-flags": "id",
"globalshop-more": "ie",
"globalshop-link": "if",
"globalshop-linktitle": "ig",
"expressway": "ih",
"travel": "ii",
"ex-bigpic": "ij",
"travel-title": "ik",
"auction": "il",
"auction-title": "im",
"secondhand": "in",
"secondhand-title": "io",
"local-life": "ip",
"local-head": "iq",
"local-head-line": "ir",
"arrow-d": "is",
"arrow-dred": "it",
"local-body": "iu",
"local-items": "iv",
"shop-guide": "iw",
"guide-hd": "ix",
"guide-bd": "iy",
"guide-left": "iz",
"left-detail": "ja",
"large-block": "jb",
"large-images": "jc",
"big-show-rotate": "jd",
"big": "je",
"big-show-left": "jf",
"big-show-right": "jg",
"small": "jh",
"text-fields": "ji",
"small-block": "jj",
"small-image": "jk",
"text-special": "jl",
"text-title": "jm",
"middle-block": "jn",
"middle-image": "jo",
"left-more": "jp",
"long": "jq",
"guide-right": "jr",
"right-block": "js",
"news": "jt",
"right-try-block": "ju",
"right-try-button": "jv",
"right-ad": "jw",
"right-bottom": "jx",
"hotsale": "jy",
"hotsale-nav": "jz",
"hotsale-list": "ka",
"loading-48": "kb",
"helper": "kc",
"helper-s1": "kd",
"helper-s2": "ke",
"helper-s3": "kf",
"helper-s4": "kg",
"helper-consumer": "kh",
"footer": "ki",
"footer-best": "kj",
"footer-ali": "kk",
"footer-more": "kl",
"footer-more-panel": "km",
"footer-more-trigger": "kn",
"foot-nav": "ko",
"footer-copyright": "kp",
"footer-ext": "kq",
"footer-ext-s1": "kr",
"footer-ext-s3": "ks",
"footer-ext-s4": "kt",
"footer-ext-s5": "ku",
"footer-ext-s6": "kv",
"footer-ext-s7": "kw",
"footer-toy": "kx",
"footer-line": "ky"
};
Binary file modified tests/map.js.gz
Binary file not shown.

0 comments on commit 8fa04f4

Please sign in to comment.