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
| function htmlEscape(html) { | |
| return String(html) | |
| .replace(/&/g, '&') | |
| .replace(/</g, '<') | |
| .replace(/>/g, '>') | |
| .replace(/"/g, '"'); | |
| } |
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
| @metro-blue : #1BA1E2; | |
| @metro-red : #E51400; | |
| @metro-green : #393; | |
| @metro-orange : #F09609; | |
| @metro-purple : #A200FF; | |
| @metro-pink : #E671B8; | |
| @metro-magenta : #FF0097; | |
| @metro-brown : #A05000; | |
| @metro-lime : #8CBF26; | |
| @metro-teal : #00ABA9; |
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
| var ObjectId = require("mongoose").Types.ObjectId; | |
| module.exports.toObjectId = function(idstr) { | |
| try { | |
| return ObjectId(idstr); | |
| } catch (err) { | |
| console.log(err); | |
| throw new errors.BadRequest("錯誤的序號"); | |
| } | |
| } |
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
| $('.scrollPage').click(function() { | |
| var elementClicked = $(this).attr("href"); | |
| var destination = $(elementClicked).offset().top; | |
| $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-20}, 500 ); | |
| return false; | |
| }); |
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
| var Request = require("request"); | |
| // USER: API 用戶名稱 | |
| // PWD: API 密碼 | |
| // SIGNATURE: 簽名 | |
| /* METHOD: SetExpressCheckout | |
| RETURNURL:當於PayPal 網站完成明細確認後,瀏覽器將帶顧客返回至此網址。 | |
| CANCELURL:當顧客選擇終止付款時,瀏覽器將帶顧客返回至此網址。 |
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
| var _alert_fallback = false; | |
| if (typeof console === "undefined" || typeof console.log === "undefined") { | |
| console = {}; | |
| if (_alert_fallback) { | |
| console.log = function(msg) {alert(msg);}; | |
| } else { | |
| console.log = function() {}; | |
| } | |
| } |
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
| var htmlEscape = function(html){ | |
| return String(html) | |
| .replace(/&(?!\w+;)/g, '&') | |
| .replace(/</g, '<') | |
| .replace(/>/g, '>') | |
| .replace(/"/g, '"'); | |
| }; | |
| var xssQQ = function(obj) { | |
| console.log("before xssQQ"); | |
| console.dir(obj); |
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
| app.post("/api/upload-picture", function(req, res) { | |
| if(!req.session.signined) { | |
| throw new BadRequest("signin first"); | |
| } | |
| if(!req.files.picture) { | |
| throw new BadRequest("illegal file element name"); | |
| } | |
| var h = new UploadPictureHandler(req, res); | |
| h.run(); | |
| }); |
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
| var zhTW = { | |
| _name : "繁體中文" | |
| , home : "首頁" | |
| , contactUs : "聯繫我們" | |
| , feedback : "意見回饋" | |
| }; | |
| var en = { | |
| _name : "English" | |
| , home : "home" |
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
| app.configure(function(){ | |
| ... | |
| // i18n | |
| var Dict = require("./Dict"); | |
| app.use(function(req, res, next){ | |
| // 取得語系 | |
| var localestr = req.headers["accept-language"]; | |
| var arr = localestr.split(","); |
NewerOlder