GithubHelp home page GithubHelp logo

vimaster / tooltips Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zamnetwork/tooltips

0.0 2.0 0.0 59 KB

This repository is to supply code examples and help bug report the XIVDB Tooltips: http://xivdb.com/?tooltip

JavaScript 59.39% CSS 40.61%

tooltips's Introduction

XIVDB Tooltips

XIVDB Tooltips

The XIVDB tooltips script (3.2kb JS / 1.8kb CSS) allows you to load Final Fantasy XIV game content on your site, all data is obtained from XIVDB, hosted on a US Server.

Examples:

Getting Started

<html>
    <head>
        ...
    </head>
    <body>
        ...
        <script src="https://secure.xivdb.com/tooltips.js"></script>
    </body>
</html>

And that is all there is to it!

Requirements

The tooltips require jQuery, if you do not have this on your site then the script will attempt to embed it for you, which should work.

Tooltip Settings

Javascript Global Settings

Here are the JavaScript global settings, each one lists its "default" state. Include this somewhere in your code if you wish to change any of the options. You don't need to include all of the options, just the ones you want to change.

var xivdb_tooltips =
{
    // Where to get tooltips from.
    source: 'https://secure.xivdb.com',

    // Language the tooltips should be in
    language: 'en',

    // Should tooltips attempt to replace the link?
    // if set to false: seturlname, seturlcolor and seturlicon will be skipped
    replace: true,

    // Should tooltips replace the name of the link?
    seturlname: true,

    // Should tooltips apply a rarity color? (eg: Relics set to Purple)
    seturlcolor: true,

    // If your site is white/bright, set this true
    seturlcolorDarken: true,

    // Should tooltips include an icon?
    seturlicon: true,

    // Should tooltips replace hidden links?
    includeHiddenLinks: false,

    // How long to wait until attempting to include jquery
    // if jquery still doesn't exist after this time, it will
    // be auto included
    jqueryCheckDelay: 500,

    // Minimum site width (pixels) to assume we're on a mobile,
    // tooltips should not be used on mobile sites.
    mobileMinimumWidth: 500,

    // Prevent this script from setting your sites html height to 100%
    // this helps with knowing mouse position.
    preventHtmlHeight: false,

    // How far the tooltip should be from the mouse
    tooltipDistanceX: 30,
    tooltipDistanceY: 30,

    //
    // EVENTS
    //

    // this is called once tooltips load, provides tooltip data,
    // eg: event_tooltipsLoaded: function(tooltips) { ... }
    event_tooltipsLoaded: null,
};

Data attribute customisation

Sometimes you may want specific links to act differently than the global setting, here are some data attributes you can use in your a tags.

Here is an example

<!-- Tooltip attached to .wrapper div -->
<div class="wrapper" data-xivdb-seturlicon="0">
    <a href="..." data-xivdb-parent=".wrapper">...</a>
</div>

<!-- single link, tooltip doesn't change anything visually -->
<a href="..." data-xivdb-replace="0">...</a>

Options:

  • data-xivdb-ignore="1" ignore this link (no tooltips appear)
  • data-xivdb-replace="0" does not replace the link with any name/color/icons.
  • data-xivdb-seturlname="0" do not replace the link with the content name
  • data-xivdb-seturlcolor="0" do not change the colour of the link to match rarity
  • data-xivdb-seturlicon="0" do not add an game icon next to the link

Advanced functionality

Here are a few Javascript funky stuff:

//
// Need to call a function once the tooltips load?
//
var xivdb_tooltips.event_tooltipsLoaded = function() {
    console.log('Tooltips loaded!');
};
//
// Does your site contain dynamic content that
// is loaded in later? (eg AJAX), force the
// tooltips to re-scan for links.
//
XIVDBTooltips.get()

//
// if your dynamically loaded content is heavy
// (eg: search results, lots of html) then you
// can call a delayed method, which will wait.
// A bit smoother.
//
XIVDBTooltips.getDelayed();
//
// Need to remove the tooltips, eg: Clicking
// a link that loads in another page?
//
XIVDBTooltips.hide();

Have any issues?

If you run into any issues, it is really easy to contact me, either:

tooltips's People

Contributors

orthographic-pedant avatar vekien avatar

Watchers

 avatar  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.