在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:smevawala/mote.io-extension开源软件地址:https://github.com/smevawala/mote.io-extension开源编程语言:JavaScript 100.0%开源软件介绍:Mote.io Chrome ExtensionHey HackNY!Promo codes for iOS are at the bottom. The internet seems to cut out randomly which may affect your demo. Mote.io doesn't require a persistant connection, but messages may be dropped or delayed. You can resolve problems by:
If worse problems occur, I'll explain the connection issues and you can fire commands from console. Thanks for your interest in building a remote for Mote.io! Here's how you can get your remote into the production version of the Mote.io extesion:
I'll review your code, merge your remote in, and then deploy it to the world! Development CycleMote.io remotes work by clicking and inspecting objects in the DOM. When a button is pressed on the phone, it fires a function which should probably click something on the page. It's annoying to define a remote, reload the extension, launch the app, sync, and press the button on the phone just to test if a function works. Instead, this is how I develop remotes:
You can also fire the button functions manually from the console once they have been added to mote.io.remote like so: mote.io.remote.blocks[0].data[0].press(); Setting up the extension in developer mode
Adding your own remote
The entry should look something like this: {
"matches": [
"http://www.pandora.com/*"
],
"js": [
"moteio.js",
"remotes/pandora.js"
],
"run_at": "document_start"
} Reloading and refreshing extension codeChrome extensions are a hassle to refresh. You need to visit You also may try this extension that adds a shortcut to reload extensions. Remote APIYou can find many examplees of remotes in the /remotes directory. A remote file looks like so: exec(function(){
mote.io.remote = {
api_version: '0.1',
app_name: 'Vimeo',
action: 'watching',
twitter: 'vimeo',
display_input: true,
init: function() {...}
update: function(force) {...},
blocks: [...]
};
}); Every remote file must be wrapped in the This function allows the javascript code to run at the document level. This means any variable you define within this function is going to be in the global scope! Config Variables
Block TypesNotifyNotify is the area in which app notifications are shown.
blocks: [
{
type: 'notify'
share: true
},
...
] SearchSearch displays a text box with a search icon
blocks: [
{
type: 'search',
action: function(query) {
alert(query);
}
}
...
] ButtonsThe buttons type represents a row of buttons.
blocks: [
{
type: 'buttons',
data: [
{...},
{...},
{...}
]
},
...
] The yellow lines here represent individual blocks of buttons. Buttons.dataData is an array of button objects. Button objects have the following properties:
Here is the middle row of the image above represented in javascript: blocks: [
{
type: 'buttons',
data: [
{
press: function () {
alert('left pressed');
},
icon: 'chevron-left'
hash: 'up'
},
{
press: function () {
alert('middle pressed');
},
icon: 'circle-blank'
hash: 'go'
},
{
press: function () {
alert('right pressed');
},
icon: 'chevron-right'
hash: 'right'
},
]
},
...
] SelectSelect represents a select box in the app.
{
type: 'select',
data: [
{...},
{...}
]
} Select.dataSelect.data is an array of select option objects. Select option objects have the following properties:
{
type: 'select',
data: [
{
optgroup: 'Latest',
text: 'Latest',
action: function() {
window.location = "/latest";
}
},
{
optgroup: 'Latest',
text: 'Freshest',
action: function() {
window.location = "/latest/fresh";
}
},
...
} MethodsNotifyNotify sends information to the notify block about what to display.
mote.io.remote = {
update: function(force) {
var thisArtist = $($('#player-nowplaying a')[3]).text(),
thisSong = $($('#player-nowplaying a')[4]).text(),
thisImage = extractUrl($('.haarp-active.section-track').find('.readpost > span').css('background-image')),
thisPerma = window.location.origin + $('.haarp-active.section-track').find('a.track').attr('href');
mote.io.notify(thisArtist, thisSong, thisImage, thisPerma, force);
}
} Update ButtonThe update button method allows you to change the color and icon of a button on a remote.
mote.io.remote = {
update: function(force) {
if($('#playerFav').hasClass('fav-on')) {
mote.io.updateButton('heart', null, '#ff0000', force);
} else {
mote.io.updateButton('heart', null, '#434345', force);
}
}
} Additional NotesjQueryThe mote.io plugin provides you with jQuery for free by using the Deferred LoadingA remote is only sent to the client once, when it is found on the webpage. Something like the following will work just fine. setTimeout(function(){
mote.io.remote = {};
}, 5000); Promo codes!
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论