Giter Site home page Giter Site logo

wme-bootstrap's Introduction

WME Bootstrap

This is a small Boostrap library for checking WME loading and providing useful events, which you can use for your scripts.

For what?

You can meet the realization of checking loading in the many scripts; it looks like this:

// ๐Ÿ‘Ž
function init() {
  /* checking */
  setTimeout(init, 200) 
}

No need more this way; look at the following code:

// ๐Ÿ‘
$(document).on('bootstrap.wme', () => { /* your code here */ } )

So I think it's clear.

Need more?

So, it is not all. This script trigger more events for common events in the WME where you can manipulate the arguments.

Require Script

// @require https://greasyfork.org/scripts/450160-wme-bootstrap/code/WME-Bootstrap.js

Events

All following events are triggered on the document

  • bootstrap.wme โ€“ when all WME-objects are ready for usage
  • none.wme โ€“ when nothing chosen
  • node.wme โ€“ when chosen node for edit
  • nodes.wme โ€“ when chosen more than one node (I'm not sure how it is possible)
  • segment.wme โ€“ when chosen segment for edit
  • segments.wme โ€“ when chosen more than one segment
  • venue.wme โ€“ when chosen place or point for edit
  • venues.wme โ€“ when chosen more than one place or point
  • point.wme โ€“ when chosen point place for edit
  • place.wme โ€“ when chosen place for edit
  • residential.wme โ€“ when chosen residential place for edit

Arguments

  • event โ€“ jQuery.Event
  • element โ€“ HTMLElement of the sidebar panel
  • model โ€“ W.model
  • models โ€“ array of W.model

Usage

(function () {
  'use strict'

  $(document)
    .on('bootstrap.wme', function () {
      console.info('ready')
    })
    .on('none.wme', (e) => {
      console.info('none')
    })
    .on('node.wme', (event, element, model) => {
      console.info('node', model)
      console.info('sidebar', element)
    })
    .on('nodes.wme', (event, element, models) => {
      console.info('nodes', models)
    })
    .on('segment.wme', (event, element, model) => {
      console.info('segment', model)
      console.info('sidebar', element)
    })
    .on('segments.wme', (event, element, models) => {
      console.info('segments', models)
    })
    .on('venue.wme', (event, element, model) => {
      console.info('venue', model)
    })
    .on('venues.wme', (event, element, model) => {
      console.info('venues', models)
    })
    .on('point.wme', (event, element, model) => {
      console.info('point', model)
    })
    .on('place.wme', (event, element, model) => {
      console.info('place', model)
    })
    .on('residential.wme', (event, element, model) => {
      console.info('residential', model)
    })
})();

Links

Author homepage: http://anton.shevchuk.name/
Script homepage: https://github.com/AntonShevchuk/wme-bootstrap
GreasyFork: https://greasyfork.org/en/scripts/450160-wme-bootstrap

wme-bootstrap's People

Stargazers

 avatar

Watchers

 avatar  avatar

wme-bootstrap's Issues

New api not working for some people

Hi Anton, thanks for great scripts!

Seems like after migrating to new userscript API (ef02bf0) it stopped working for some people (including me). wme-logged-in / wme-ready is never triggered.

See for example last messages in this thread:
https://www.waze.com/forum/viewtopic.php?t=87931&start=200

Last update (0d3e549) also did not fix the problem.

Old version (https://greasyfork.org/en/scripts/450160-wme-bootstrap?version=1126584) works fine.

May this new API not be available in some regions / for some users?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.