|
|
| Line 178: |
Line 178: |
| draw(); | | draw(); |
| }); | | }); |
|
| |
|
| |
| (function() {
| |
| var answers = ['It is certain.','Ask again later.','Outlook not so good.',
| |
| 'Signs point to yes.','Very doubtful.','Without a doubt.','Cannot predict now.','Yes definitely!'];
| |
| var div = document.createElement('div');
| |
| div.style.cssText = 'text-align:center;padding:8px;border:1px solid #a2a9b1;border-radius:6px;margin:8px 0;background:#f8f9fa;';
| |
| div.innerHTML = '<b>🎱 Magic 8-Ball</b><br><small>Think of a question...</small><br>' +
| |
| '<button id="mw-8ball" style="margin-top:6px;cursor:pointer;padding:4px 10px;">Ask!</button>' +
| |
| '<p id="mw-8ball-ans" style="font-style:italic;min-height:20px;margin:6px 0 0;"></p>';
| |
| var tb = document.querySelector('#p-tb .body, #p-tb ul');
| |
| if (tb) tb.parentElement.insertBefore(div, tb.nextSibling);
| |
| document.getElementById('mw-8ball').addEventListener('click', function() {
| |
| document.getElementById('mw-8ball-ans').textContent = answers[Math.floor(Math.random() * answers.length)];
| |
| });
| |
| })();
| |