This file contains 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
//microdata polyfill (see https://github.com/termi/Microdata-JS) | |
casper.options.clientScripts.push("../../../support/a.js"); | |
casper.options.clientScripts.push("../../../support/microdata-js.js"); | |
/** | |
* Fetches microdata from the remote DOM environment, in a json object structure. | |
* @param itemType The item type of item scopes to fetch data for | |
* @returns {Object|mixed} | |
*/ | |
casper.fetchMicrodata = function(itemType) { |
This file contains 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
/** | |
* Asserts a microdata item value matches the given expected value in the remote DOM environment | |
* Depends on the casper.fetchMicrodata method | |
* | |
* @param itemType {String} The item type of the item scopes to look for properties in | |
* @param property {String} The name of the property the compare the expected value against | |
* @param expectedItemValue {String} The expected value of the item property | |
* @param message {String} The assertion message | |
* @param itemTypeIndex {Number} A specific index of an item scope to use. If omitted or null, will look for matches in | |
* all item scopes |
This file contains 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
//little util to do tidier directory concatenation | |
function dir() { | |
var args = Array.prototype.slice.call(arguments); | |
var prefix = ""; | |
if(args[0] === "!") { | |
prefix = args[0]; | |
args.shift(); | |
} | |
return prefix + args.join("/"); | |
} |
This file contains 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 items = [{ | |
html: '<p>One</p>' | |
}, { | |
html: '<p>Two</p>' | |
}, { | |
html: '<p>Three</p>' | |
}]; | |
var html = items.reduce(function(html, item) { | |
html.push(item.html); |
This file contains 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
<?xml version="1.0"?> | |
<project default="cssDataUriEmbed" basedir="." xmlns:ca="antlib:net.sourceforge.clearantlib"> | |
<property name="build.dir" location="${basedir}/build" /> | |
<property name="websrc.dir" location="${basedir}/WebContent" /> | |
<taskdef name="cssurlembed" classname="net.nczonline.web.cssembed.CSSEmbedAntTask" > | |
<classpath> | |
<fileset dir="${basedir}/lib" includes="cssembed-0.3.3.jar"/> | |
</classpath> | |
</taskdef> | |
<target name="setup"> |
This file contains 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 !IE]>--> | |
<link type="text/css" rel="stylesheet" href="/css/site-datauri.css"> | |
<!--<![endif]--> | |
<!--[if gte IE 9]> | |
<link type="text/css" rel="stylesheet" href="/css/site-datauri.css"> | |
<![endif]--> | |
<!--[if lte IE 8]> | |
<link type="text/css" rel="stylesheet" href="/css/site-mhtml.css"> | |
<![endif]--> |
This file contains 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 Dog = [ | |
"bark", "eat", "defecate" | |
]; | |
var Poodle = function(name) { //implements Dog | |
this.name = name; | |
}; | |
Poodle.prototype = { | |
bark: function() {}, | |
eat: function() {}, | |
defecate: function() {} |
This file contains 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 car factory | |
var CarFactory = { | |
getTires: function() { | |
if(weather.raining) { | |
return new WetTireSet(); | |
} | |
else { | |
return new SlickTireSet(); | |
} | |
} |
This file contains 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
<script> | |
(function() { | |
function addStylesheet(dataUriHref, fallbackHref) { | |
var img = new Image(); | |
img.onload = img.onerror = function() { | |
var link = window.document.createElement("link"); | |
link.type = "text/css"; | |
link.rel = "stylesheet"; | |
link.href = this.width !== 1 ? fallbackHref : dataUriHref; |
This file contains 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 casper = require('casper').create({ | |
verbose: true, | |
logLevel: 'info' | |
}); | |
var page = require('webpage').create(); | |
var utils = require('utils'); | |
//args | |
var base = casper.cli.get('out'); | |
var width = parseInt(casper.cli.get("width")); |
OlderNewer