|
|
(9 intermediate revisions by 5 users not shown) |
Line 1: |
Line 1: |
| // ==UserScript==
| | User scripts are programs which make on-the-fly changes to specific web pages, typically to change their appearance or to add or modify functionality. |
| // @name Satyam
| |
| // @namespace http://thecinema.in/
| |
| // @description script to play sound if ticket is available
| |
| // @include http://thecinema.in/*
| |
| // @resource GMwavaudio http://www.sensongs.com/UNDG/Tamil/Va%20Quarter%20Cutting /09%20The%20Quarter%20Song%20Club%20Mix%20Remix%20Dj%20Vijay%20Chawla.mp3
| |
| // ==/UserScript==
| |
|
| |
|
| var oggB64 = GM_getResourceURL("GMwavaudio");
| | User scripts for [[Greasemonkey]] and Greasemonkey-compatible alternatives are written in [http://developer.mozilla.org/en/docs/JavaScript JavaScript]. |
| var au = document.createElement('audio');
| | If you would like to write user scripts yourself, see [[Greasemonkey Manual:Editing]]. |
| var ausrc = 'data:audio/wav;base64,'+oggB64.split('data:application/octet-stream;base64,')[1];
| |
| au.setAttribute('src', ausrc);
| |
| au.setAttribute('id', 'GMwavaudio');
| |
| document.body.appendChild(au);
| |
|
| |
|
| var intval='';
| | == See Also == |
| console.log('scriptloaded1');
| | * [[wikipedia:Augmented browsing|Augmented browsing at Wikipedia]] |
| intval=setInterval(function()
| |
| {
| |
| var http = new XMLHttpRequest();
| |
| var url = '/webWCF/AjaxBackService.svc/GetTicketDetail';
| |
| var params = '{"movieID":"ST00001292","date":"Friday |10 september"}';
| |
| | |
| http.open("POST", url, true);
| |
| | |
| //Send the proper header information along with the request
| |
| http.setRequestHeader("Content-type", "application/json");
| |
| http.setRequestHeader("Content-length", params.length);
| |
| http.setRequestHeader("Connection", "close");
| |
| | |
| http.onreadystatechange = function() {//Call a function when the state changes.
| |
| if(http.readyState == 4 && http.status == 200) {
| |
| | |
| var json=eval('(' +http.responseText+')');
| |
| if(json&&json.d&&json.d.length>0)
| |
| {
| |
| for(var i=0;i<json.d.length;i++)
| |
| {
| |
| if(json.d[i].DaySessionNo=="4"&&json.d[i].TicketTypes)
| |
| {
| |
| for(var j=0;j<json.d[i].TicketTypes.length;j++)
| |
| {
| |
| au.play();
| |
|
| |
| if(intval!="")
| |
| clearInterval(intval);
| |
| | |
| var ticket=json.d[i].TicketTypes[j];
| |
| if(ticket)
| |
| {
| |
| console.log(ticket.SessionID);
| |
| console.log(ticket.SessionName);
| |
| console.log(ticket.TicketDetail);
| |
| console.log(ticket.Time);
| |
| }
| |
| }
| |
| }
| |
| }
| |
| }
| |
| else
| |
| {
| |
| console.log('NA at '+Date());
| |
| }
| |
| }
| |
| }
| |
| http.send(params);
| |
| }
| |
| ,30000)
| |
User scripts are programs which make on-the-fly changes to specific web pages, typically to change their appearance or to add or modify functionality.
User scripts for Greasemonkey and Greasemonkey-compatible alternatives are written in JavaScript.
If you would like to write user scripts yourself, see Greasemonkey Manual:Editing.
See Also