IRKit jQuery Sample mash Follow 2016-01-25 15:39:01 License: MIT License Fork14 Fav1 View26345 Play Stop Reload Fullscreen Smart Phone Fork tree Readme JavaScript 47 lines HTML 19 lines CSS 0 lines Minimal Remote Controller Form IRKit jQuery Sample jQuery v2.0.3 bootstrap.js 3.0.0 $(function() { $("#aircon-on").click(function() { $(document.remotecontroller.message).val('{"freq":38,"format":"raw","data":[6573,3257,867,824,866,825,865,2463,866,826,864,2462,867,825,864,827,863,828,863,2464,866,2462,867,826,864,826,865,826,864,2463,866,2461,868,825,865,826,864,827,864,826,865,826,864,826,865,826,864,826,865,825,866,826,864,826,865,826,864,827,864,2462,867,826,864,826,865,826,864,827,864,827,864,826,864,826,865,2461,868,825,865,826,865,826,864,827,864,2462,867,2461,867,2461,868,2461,867,2461,868,2461,867,2461,868,2461,867,826,864,826,865,2461,866,826,864,827,864,828,863,827,864,826,865,826,865,825,865,826,865,2462,867,2462,866,825,865,826,865,2462,867,825,865,826,865,825,865,826,865,2461,868,825,865,2462,867,2462,867,825,865,826,864,827,864,825,865,826,865,826,865,825,865,826,865,826,864,827,864,826,865,826,864,826,865,2462,867,825,865,827,864,825,864,827,863,827,863,829,863,827,864,827,864,826,865,826,864,826,865,826,865,825,865,827,864,827,864,826,864,827,864,826,864,826,865,826,865,826,864,826,865,826,864,827,864,827,864,826,864,827,864,826,865,2462,867,825,865,2462,867,825,865,826,864,826,865,2463,866,2461,867,826,865,825,865,827,864,2462,867,2461,867]}'); }); $("#aircon-off").click(function() { $(document.remotecontroller.message).val('{"format":"raw","freq":38,"data":[6530,3297,825,867,823,867,822,2504,825,866,824,2502,873,819,871,820,871,819,870,2455,874,2454,874,818,871,819,872,818,871,2454,875,2453,875,817,873,817,872,818,873,817,873,818,872,818,872,818,872,818,873,817,873,817,873,817,873,817,873,818,873,2453,875,817,873,817,873,817,873,817,873,817,873,817,873,817,874,2452,876,816,873,817,873,818,873,817,873,2453,875,816,874,816,874,816,874,816,874,817,873,817,873,2452,877,815,874,2453,876,2450,877,2451,877,2451,876,2451,877,2450,877]}');; }); $(document.remotecontroller).submit(function() { var hostname = $(document.remotecontroller.hostname).val(); if (! hostname) { alert( "fill hostname" ); return false; } var message = $(document.remotecontroller.message).val(); if (! message) { alert( "fill Signal as JSON" ); return false; } var password = $(document.remotecontroller.password).val(); if (! password) { alert( "fill password" ); return false; } try { JSON.parse(message); } catch (e) { alert( "Signal is invalid JSON" ); return false; } // I wish if we could JSON.stringify, but we can't ... message = message.replace("{", "{\"password\":\""+password+"\","); console.log("sending message: ", message); $.ajax({ type : "POST", url : "http://" + hostname + "/messages", data : message, complete : function(jqxhr, status) { console.log("complete: ", jqxhr, status); } }); return false; }); }); <div class="jumbotron"> <form role="form" class="" name="remotecontroller"> <div class="form-group"> <label for="hostname">IRKit hostname</label> <input type="text" class="form-control" placeholder="IP address or IRKitXXXX.local hostname" name="hostname"> </div> <div class="form-group"> <label for="hostname">IR signal JSON representation</label> <textarea class="form-control" placeholder="" name="message"></textarea> <small>presets:</small><span class="label"><a href="#" id="aircon-on">aircon-on</a> <a href="#" id="aircon-off">aircon-off</a></span> </div> <div class="form-group"> <label for="password">IRKit password</label> <input type="text" class="form-control" placeholder="Wi-Fi accesspoint password" name="password"> </div> <button type="submit" class="btn btn-default">Send</button> </form> </div> IRKit jQuery Sample bootstrap.css 3.0.0 Minimal Remote Controller Form $(function() { $("#aircon-on").click(function() { $(document.remotecontroller.message).val('{"freq":38,"format":"raw","data":[6573,3257,867,824,866,825,865,2463,866,826,864,2462,867,825,864,827,863,828,863,2464,866,2462,867,826,864,826,865,826,864,2463,866,2461,868,825,865,826,864,827,864,826,865,826,864,826,865,826,864,826,865,825,866,826,864,826,865,826,864,827,864,2462,867,826,864,826,865,826,864,827,864,827,864,826,864,826,865,2461,868,825,865,826,865,826,864,827,864,2462,867,2461,867,2461,868,2461,867,2461,868,2461,867,2461,868,2461,867,826,864,826,865,2461,866,826,864,827,864,828,863,827,864,826,865,826,865,825,865,826,865,2462,867,2462,866,825,865,826,865,2462,867,825,865,826,865,825,865,826,865,2461,868,825,865,2462,867,2462,867,825,865,826,864,827,864,825,865,826,865,826,865,825,865,826,865,826,864,827,864,826,865,826,864,826,865,2462,867,825,865,827,864,825,864,827,863,827,863,829,863,827,864,827,864,826,865,826,864,826,865,826,865,825,865,827,864,827,864,826,864,827,864,826,864,826,865,826,865,826,864,826,865,826,864,827,864,827,864,826,864,827,864,826,865,2462,867,825,865,2462,867,825,865,826,864,826,865,2463,866,2461,867,826,865,825,865,827,864,2462,867,2461,867]}'); }); $("#aircon-off").click(function() { $(document.remotecontroller.message).val('{"format":"raw","freq":38,"data":[6530,3297,825,867,823,867,822,2504,825,866,824,2502,873,819,871,820,871,819,870,2455,874,2454,874,818,871,819,872,818,871,2454,875,2453,875,817,873,817,872,818,873,817,873,818,872,818,872,818,872,818,873,817,873,817,873,817,873,817,873,818,873,2453,875,817,873,817,873,817,873,817,873,817,873,817,873,817,874,2452,876,816,873,817,873,818,873,817,873,2453,875,816,874,816,874,816,874,816,874,817,873,817,873,2452,877,815,874,2453,876,2450,877,2451,877,2451,876,2451,877,2450,877]}');; }); $(document.remotecontroller).submit(function() { var hostname = $(document.remotecontroller.hostname).val(); if (! hostname) { alert( "fill hostname" ); return false; } var message = $(document.remotecontroller.message).val(); if (! message) { alert( "fill Signal as JSON" ); return false; } var password = $(document.remotecontroller.password).val(); if (! password) { alert( "fill password" ); return false; } try { JSON.parse(message); } catch (e) { alert( "Signal is invalid JSON" ); return false; } // I wish if we could JSON.stringify, but we can't ... message = message.replace("{", "{\"password\":\""+password+"\","); console.log("sending message: ", message); $.ajax({ type : "POST", url : "http://" + hostname + "/messages", data : message, complete : function(jqxhr, status) { console.log("complete: ", jqxhr, status); } }); return false; }); }); <div class="jumbotron"> <form role="form" class="" name="remotecontroller"> <div class="form-group"> <label for="hostname">IRKit hostname</label> <input type="text" class="form-control" placeholder="IP address or IRKitXXXX.local hostname" name="hostname"> </div> <div class="form-group"> <label for="hostname">IR signal JSON representation</label> <textarea class="form-control" placeholder="" name="message"></textarea> <small>presets:</small><span class="label"><a href="#" id="aircon-on">aircon-on</a> <a href="#" id="aircon-off">aircon-off</a></span> </div> <div class="form-group"> <label for="password">IRKit password</label> <input type="text" class="form-control" placeholder="Wi-Fi accesspoint password" name="password"> </div> <button type="submit" class="btn btn-default">Send</button> </form> </div> use an iframe compat browser, deer Play on jsdo.it games Author Share ブログに埋め込む QR Tag Download Complete! Description What kind of game? Minimal Remote Controller Form Control Device Smartphone Controllerjsdo.it WebSocket Controller» Mouse Keyboard Touch Device Fullscreen Activated Inactivated jsdo.it games から削除する Submit Author mash URLhttp://maaash.jp/ http://twitter.com/maaash/ http://wonderfl.net/user/mash mostly mash, but sometimes maaash Tweet Default Panel Auto play Screenshot Readme JavaScript HTML CSS Size Width: px Height: px code <script type="text/javascript" src="http://jsdo.it/blogparts/d6BI/js"></script> application IRKit Discussion Questions on this code? Tags IRKit application Favorite by yic666kr Forked sort by latest page views favorite forked IRKit setup in JavaScript mash 00 1805 41/49/8 IRKit application forked: IRKit jQuery Sample sa33yu40 00 356 48/19/10 IRKit application forked: IRKit jQuery Sample sa33yu40 00 241 48/19/10 IRKit application forked: IRKit jQuery Sample deepaknverma 00 314 48/19/10 IRKit application 1 2 3 4NEXT>>