Skip to content

Instantly share code, notes, and snippets.

YUI({
onCSS: function () {
alert("picker.css is loaded.");
},
modules: {
"picker-css": {
base: "http://josephj.com/lab/2011/yui3-load-css/",
path: "picker.css",
type: "css"
}
/**
* The utility function to append JavaScript for script tag hack.
*
* @method _appendScript
* @param url {String} The JavaScript URL.
* @param loadHandler {Event} The onload event handler (optional).
* @return {HTMLElement} The script element.
*/
_appendScript = function (url, loadHandler) {
loadHandler = loadHandler || null;
@josephj
josephj / xxx.html
Created February 1, 2012 09:41
HTML Test
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Prototype</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/cssreset/reset-min.css">
<link rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/cssfonts/fonts-min.css">
<script type="text/javascript" src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
<script src="https://raw.github.com/josephj/yui3-crossframe/master/crossframe.js"></script>
<style type="text/css">
<link rel="stylesheet" href="themes/base/jquery.ui.all.css">
<script src="jquery-1.7.2.js"></script>
<script src="ui/jquery.ui.core.js"></script>
<script src="ui/jquery.ui.widget.js"></script>
<script src="ui/jquery.ui.accordion.js"></script>
@josephj
josephj / fsck-git-log.sh
Created July 27, 2012 03:37
檔案在 git pull 後被刪除、可以用 git fsck 救回來
# 這個時候檔案都已經做完,想要放到 Github 上
josephj@cockatoo /var/www/josephj/frontend/lab/2012/qt-webkit $ % git init .
Initialized empty Git repository in /var/www/josephj/frontend/lab/2012/qt-webkit/.git/
# Github 的 Repo 也已經開好了 (已經產生好 README.md)
josephj@cockatoo /var/www/josephj/frontend/lab/2012/qt-webkit $ % git remote add origin git@github.com:miiicasa/tv-apps-html.git
# 先試著從 Github 上抓東西下來
josephj@cockatoo /var/www/josephj/frontend/lab/2012/qt-webkit $ % git pull
remote: Counting objects: 3, done.
mods[“ykpsb”] = function () {
// 利用闭包与外界隔绝
var privateVar,
publicFn;
// 内部自行处理,不会影响其他模块
privateVar = "123";
publicFn = function () {};
@josephj
josephj / mask.scss
Created October 19, 2012 02:50
A pure CSS mask which centralizes content inside. ( http://josephj.com/lab/2012/mask/demo.html )
@import "compass";
/**
* A pure CSS mask which centralizes content inside.
* This technique is compatible with IE7+ and major standard browsers.
*
* Required HTML structure:
*
* <div class="mask">
* <div class="mask-box">
* <div class="mask-inner-box">
@josephj
josephj / demo.html
Last active December 11, 2015 05:38
Image / Text module sample.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Image / Text Module</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.7.2/build/cssreset/reset-min.css">
<link rel="stylesheet" href="http://yui.yahooapis.com/3.7.2/build/cssfonts/fonts-min.css">
<style>
.mod {
width: 50%; /* Set flexible layout for testing */
@josephj
josephj / iframe-step.html
Last active December 11, 2015 22:28
Using native JavaScript to create an OO-style step control.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="">
<meta name="created" content="2013-01-28">
<title> Prototype</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.7.2/build/cssreset/reset-min.css">
<link rel="stylesheet" href="http://yui.yahooapis.com/3.7.2/build/cssfonts/fonts-min.css">
<style type="text/css">
@josephj
josephj / iframe-step.js
Last active December 12, 2015 06:19
YUI Widget Sample
// START WRAPPER: The YUI.add wrapper is added by the build system, when you
// use Shifter to build your component from the raw source in this file
YUI.add("iframe-step", function(Y) {
/* Any frequently used shortcuts, strings and constants */
var Lang = Y.Lang;
/* IframeStep class constructor */
function IframeStep(config) {
IframeStep.superclass.constructor.apply(this, arguments);