Giter Club home page Giter Club logo

better-entity-link's Introduction

Better Entity Link

Improve your productivity with contextmenus on entity links!

πŸš€ No configuration

πŸ—ΊοΈ Work with all windows

πŸ’¬ Work with all languages

❀️ Work with all systems

🀝 Extensible with other modules

Minimum Core Version: v9

Demo

Preview and activate scenes from scene link:

scene-contextmenu

Roll a table from rolltable link:

rolltable-contextmenu

Extensibility

You are a developer and you want to add your own action to contextmenus? Here's how to !

Hooks.on("ready", () => {

  // Register an action for Scene document link
  game.modules.get("better-entity-link").registerSceneAction({
      name: "SCENES.View",
      icon: "fa-eye fa-fw",
      condition: async document => game.user.isGM,
      callback:  async entity => await entity.view()
  });
  
  // Register "Roll" action on RollTable document link
  game.modules.get("better-entity-link").registerRolltableAction({
      name: "TABLE.Roll",
      icon: "fa-dice-d20",
      condition: async document => game.user.isGM || game.user.isTrusted
          || [CONST.ENTITY_PERMISSIONS.OBSERVER, CONST.ENTITY_PERMISSIONS.OWNER].includes(entity.permission),
      callback:  async document => await document.draw()
  });
    
}

Actions menu must be register on "ready" event. All module methods are registered in game.modules.get("better-entity-link"). Here is all available methods:

  • registerActorAction(options)
  • registerItemAction(options)
  • registerSceneAction(options)
  • registerJournalEntryAction(options)
  • registerMacroAction(options)
  • registerRolltableAction(options)

Argument options is an object like this:

{
    name:      "Action label",        // Name of action displayed in contextmenu. Support i18n key.
    icon:      "fa-eye",              // No need to give all <i> tag, just font-awesome icon name. You can give multiple ones
    condition: async () => true,      // An optional async predicate to show or hide action whyen context menu is rendered
    callback:  async (document) => {} // Async method to execute on click. `document` is resolved for you based on used register methods, id and pack in link.
}

better-entity-link's People

Contributors

azfarbadaroudine avatar

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.