JSFiddle - React, Tailwind, and code Playground
by dledle2
JavaScript
javascript:
/* fiddle note: todo-make a CLOSE the comments function */
/* fiddle note: use with http://www.nytimes.com/2014/06/09/business/cyberattack-insurance-a-challenge-for-business.html?src=se&_r=1
i'm trying to find a subclass by using getElementsByTagName
and right now the value of length is always 0
*/
try {
var $ = require('jquery/nyt');
var anchors2 = document.querySelectorAll('button.button.comments-button.theme-kicker');
/* anchors2[0] is [object HTMLButtonElement] in webkit safari5 */
anchors2[0].click();
/* $(anchors2).click(); WORKING JQUERY WAY HERE */
/*
var mya1 = document.getElementsByClassName('comments-panel');
var mya2 = mya1.getElementsByClassName('panel-wide');
*/
/* example (from http://stackoverflow.com/questions/18524834/change-css-style-of-a-subclass-with-javascript)
: var anchors = document.querySelectorAll('ul#main-menu li a'); */
var anchors1 = document.querySelectorAll('div .comments-panel.panel-wide');
for (var i = 0, len = anchors1.length; i < len; i++) {
anchors1[i].style.width = '100%25';
anchors1[i].style.top = '0px';
}
/*
comments-button
openpanel
*/
/* anchors2.click;
anchors2.fireEvent('initialize');
anchors2.fireEvent('openPanel');
*/
/* anchors2.fireEvent('click', 'openPanel' ); */
/*
alert(anchors2[0]);
alert(anchors2[0].length);
alert(anchors2[0].toSource());
*/
/*
for (var index = 0; index < mya1.length; index++) {
alert(mya1[i]);
}
*/
/*
function outerHTML(node) {
return node.outerHTML || new XMLSerializer().serializeToString(node);
}
*/
/* alert(JSON.stringify(YOUR_OBJECT_HERE, null, 4));
*/
/*
for (var index = 0; index < mya1.length; index++) {
alert(outerHTML(mya1[i]));
}
*/
} catch (myError1) {
alert(myError1);
}