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 isPicked = function(rate) { | |
var id = baidu.cookie.get('BAIDUID'); | |
if (!id) { return false; } | |
id = id.replace(/:.*/, ''); | |
for (var i = 0, l = id.length, sum = 0; i < l; i++) { | |
sum += id.charCodeAt(i); | |
} | |
return (sum % 100 < rate); | |
}; | |
if (isPicked(30)) { |
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 server = require('webserver').create(); | |
var service = server.listen(8080, function (request, response) { | |
response.statusCode = 200; | |
response.write('\ | |
<script> \ | |
document.addEventListener("DOMContentLoaded", function() { console.log("DOMContentLoaded"); }, false); \ | |
window.addEventListener("load", function() { console.log("window.onload"); }, false); \ | |
</script>'); | |
response.close(); |
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
.gift_exchange_paging td { | |
width:16px; | |
height:16px; | |
text-align: center; | |
font-weight:bold; | |
border: 0px solid #006AB3; | |
font-size:12px; | |
} | |
.gift_exchange_paging td.current { |
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
<table class="gift_exchange_paging" cellspacing="0" cellpadding="0" border="0"> | |
<tr> | |
<td class="prev"> </td> | |
<td class="current">1</td> | |
<td><a href="http://bb-testing-ps110.vm.baidu.com:8080/index.php/crowdtest/gift/exchange/type/3/page/2">2</a></td> | |
<td class="next"><a href="http://bb-testing-ps110.vm.baidu.com:8080/index.php/crowdtest/gift/exchange/type/3/page/2"></a></td> | |
</tr> | |
</table> |
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 page = require('webpage').create(); | |
page.settings.loadImages = false; | |
page.onConsoleMessage = function(msg) { console.log(msg); }; | |
var count = 0; | |
page.onLoadFinished = function() { | |
(0 == count++) && page.evaluate(function() { | |
// cross-domain iframe access | |
var i = document.createElement('iframe'); | |
i.src = 'http://www.phantomjs.org/'; |
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 page = require('webpage').create(); | |
page.settings.loadImages = false; | |
page.onConsoleMessage = function(msg) { console.log(msg); }; | |
var pageUrl = 'http://www.bloggersentral.com/2010/08/how-put-add-adsense-on-blogger.html'; | |
var num = 0; | |
var max = 2; | |
page.onLoadFinished = function() { | |
var text = page.evaluate(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
var page = require('webpage').create(); | |
page.settings.loadImages = false; | |
page.onConsoleMessage = function(msg) { console.log(msg); }; | |
page.onLoadFinished = function() { | |
page.evaluate(function() { | |
var getFrames = function(doc) { | |
var frames = doc.querySelectorAll('iframe'); | |
for (var i = frames.length - 1; i >= 0; i--) { | |
var fdoc = frames[i].contentWindow.document; |
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
<html> | |
<body> | |
<table width="251" cellspacing="0" cellpadding="0" align="left" valign="bottom"> | |
<tr> | |
<td> | |
<div id="show_cart"> | |
<a href="next.htm"> | |
<img src="cart.png" border="0" width="251" height="71"> | |
</a> |
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
const PHANTOM_FUNCTION_PREFIX = '/* PHANTOM_FUNCTION */'; | |
var page = require('webpage').create(); | |
page.onConsoleMessage = function(msg) { | |
if (msg.indexOf(PHANTOM_FUNCTION_PREFIX) === 0) { | |
eval('(' + msg + ')()'); | |
} else { | |
console.log(msg); | |
} |
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
function loadPage(url ) { | |
/* Load a page and print out its links */ | |
var page = require('webpage').create(); | |
page.onLoadFinished = function (status) { | |
var links = page.evaluate(function() { | |
return [].join.call(document.links); | |
}).split(','); | |
console.log("Total links: " + links.length); |
OlderNewer