Disclosure, this is meant as a joke.
I made a chrome extension that will add radio buttons and a submit button to the Cemetech terms of service page. When you make a selection and click submit, it will send a message in sax with your selection. Rolling Eyes
Here is a link to the crx file (packaged extension that you can open with winrar, 7-zip or an additionnal chrome extension)
The code is quite trashy because I wrote it quickly and without much regard for efficiency. For those who would like to have a look at the js, here it is

Code:
var form = document.createElement("FORM");
var agreeNode = document.createElement("INPUT");
agreeNode.setAttribute("type", "radio");
agreeNode.setAttribute("id", "radio1");
agreeNode.setAttribute("name", "radiobutt");
var disagreeNode = agreeNode.cloneNode(true);
disagreeNode.setAttribute("id", "radio2");
var agreeLabel = document.createElement("label");
agreeLabel.innerHTML = "Agree";
var disagreeLabel = document.createElement("label");
disagreeLabel.innerHTML = "Disagree<br>";
agreeLabel.setAttribute("for", "radio1");
disagreeLabel.setAttribute("for", "radio2");
var submitButton = document.createElement("INPUT");
submitButton.setAttribute("type", "button");
submitButton.setAttribute("value", "Submit");
submitButton.setAttribute("id", "formsub");
form.append(agreeNode);
form.append(agreeLabel);
form.append(disagreeNode);
form.append(disagreeLabel);
submitButton.setAttribute("onclick", "var radio1 = document.getElementById('radio1').checked;var radio2 = document.getElementById('radio2').checked;if (radio1){document.getElementById('saxtalk').value='I Agree with the Cemetech Terms of Service';document.getElementsByClassName('saxsubmit')[0].click();}if (radio2){document.getElementById('saxtalk').value='I Disagree with the Cemetech Terms of Service';document.getElementsByClassName('saxsubmit')[0].click();}");
form.append(submitButton);
document.getElementsByClassName("mainbodyinner")[0].append(form);
document.getElementsByClassName("mainbodyinner")[0].insertBefore(document.createElement("BR"), form);

There is no need for a form at all, because I'm not using the onsubmit event, but that was left behind in the making, so now the buttons are in a form and I can't be bothered to fix it since it works either way.
Here is a link to the TOS page if you don't know where to find it and would like to check it out.
And here is a quick pic of what it actually does.
A much simpler approach would be to append your desired content directly to the .innerHTML of the TOS box. You could also use .querySelector to save some bytes and energy (not like it matters, but the typing time helps with faster iteration). You could probably do it all in one line of code, funnily enough.
_iPhoenix_ wrote:
A much simpler approach would be to append your desired content directly to the .innerHTML of the TOS box. You could also use .querySelector to save some bytes and energy (not like it matters, but the typing time helps with faster iteration). You could probably do it all in one line of code, funnily enough.

I had some more free time, so I made a one-liner version, although its a pretty long line Laughing it is exactly half the size of the code above.

Code:
document.getElementsByClassName("mainbodyinner")[0].innerHTML=document.getElementsByClassName("mainbodyinner")[0].innerHTML+"<br><input type='radio' id='radio1' name='radiobutt'><label for='radio1'>Agree</label><input type='radio' id='radio2' name='radiobutt'><label for='radio2'>Disagree</label><br><input type='button' value='Submit' onclick=\"var radio1=document.getElementById('radio1').checked;var radio2=document.getElementById('radio2').checked;if (radio1){document.getElementById('saxtalk').value='I Agree with the Cemetech Terms of Service';document.getElementsByClassName('saxsubmit')[0].click();}if (radio2){document.getElementById('saxtalk').value='I Disagree with the Cemetech Terms of Service';document.getElementsByClassName('saxsubmit')[0].click();}\">";
mr womp womp wrote:
_iPhoenix_ wrote:
A much simpler approach would be to append your desired content directly to the .innerHTML of the TOS box. You could also use .querySelector to save some bytes and energy (not like it matters, but the typing time helps with faster iteration). You could probably do it all in one line of code, funnily enough.

I had some more free time, so I made a one-liner version, although its a pretty long line 0x5 it is exactly half the size of the code above.

Code:
document.getElementsByClassName("mainbodyinner")[0].innerHTML=document.getElementsByClassName("mainbodyinner")[0].innerHTML+"<br><input type='radio' id='radio1' name='radiobutt'><label for='radio1'>Agree</label><input type='radio' id='radio2' name='radiobutt'><label for='radio2'>Disagree</label><br><input type='button' value='Submit' onclick=\"var radio1=document.getElementById('radio1').checked;var radio2=document.getElementById('radio2').checked;if (radio1){document.getElementById('saxtalk').value='I Agree with the Cemetech Terms of Service';document.getElementsByClassName('saxsubmit')[0].click();}if (radio2){document.getElementById('saxtalk').value='I Disagree with the Cemetech Terms of Service';document.getElementsByClassName('saxsubmit')[0].click();}\">";


Just for giggles, I golfed it down as much as I could.


Code:
var d=document,a=d.querySelector('.saxtalk'),b= d.querySelector('.saxsubmit').click,t="gree with the Cemetech Terms of Service";
d.querySelector(".mainbodyinner").innerHTML+="<br><input type='radio' id='r' name='n'><label for='r'>Agree</label><input type='radio' id='s' name='n'><label for='s'>Disagree</label><br><input type='button' value='Submit' onclick=\"if (d. querySelector('#r').checked){a.value='I A'+t;b()}if (d.querySelector('#s').checked){a.value='I Disa'+t;b()}\">"

It might not work, it's entirely untested.

This is actually really cool, but it would be a much more interesting "tool" if it added a disagree option to other websites, too!
You can't quite do that, because you are inserting the 'onclick' part in the page, but the variables you defined (d, a, b and t) aren't defined in the page, you would have to also insert those initializations, which would add quite a significant amount of code. I'm sure you could scrape off a hundred bytes off of mine if you tryharded, but not like this.
Also, I've been considering making a much bigger extension that would actually change more significant parts of cemetech, but obviously, time is a big problem.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement