Giter VIP home page Giter VIP logo

countdowncube's People

Contributors

cristiancantoro avatar ghdi avatar oofaish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

countdowncube's Issues

onEnd callback error

Hi.
Thanks for sharing your job.
I'm facing with error after using this plugin.
The error content is:
countdownCube.min.js:1 Uncaught TypeError: Cannot read property 'id' of undefined
at Object.onEndCallback (countdownCube.min.js:1)
at Object.setTimeLeft (countdownCube.min.js:1)
at countdownCube.min.js:1

onEndCallback @ countdownCube.min.js:1
  setTimeLeft @
  (anonymous) @
  setTimeout (async)  
  init @
  Plugin @
  (anonymous) @
  each @
  each @
  $.fn.countdownCube @
  (anonymous) @

Thanks a lot.

Other language support

Hello! Is there an option to translate the Year, Month, Day, Hours, Minute and Seconds.

Because I'm using it on site that is in french and I would like to translate the countdown in french.

So I was wondering there is a way to do it or you're planning to add the feature. Yes I know I can hardcode it myself but hacking the code plugin is still not a good practice.

But anyways thanks a lot for your plugin. It works great!

Conflict with Array extensions

Hi,

First of all: great little plugin!

In one of my projects, I have extended the Javascript Array class with some added functionality, for example:

 Array.prototype.distinct = function ()
    {
        let distinctValues = []

        this.forEach(function (value)
        {
            if (distinctValues.includes(value))
            {
                return
            }

            distinctValues.push(value)
        })

        return distinctValues
    }

If I include these extensions whilst also using countdownCube, in the above example, I get the error that 'this.forEach is not a function', the reason being that somehow, 'distinct' is tagged on as an entry in 'this.topTags' (although logging 'this.topTags' to the console won't show it), which causes the 'this' context of 'distinct' to be:

cube = element.append('<section></section>')
                               .children(':last')
                               .attr('id', tag )
                               .addClass( "countdownCubeContainer" )
                               .append('<div></div>')
                               .children(':last')
                               .addClass('countdownCubeCube')
                               .data('side', 'show-front');

I don't know why this happens, probably my own short comings, but it might as well be a bug in the core javascript for all I know.

The fix I implemented is to explicitly define 'this.topTags' as an Array and cycle through it using the 'of' keyword (i.s.o cycling through it with the 'in' keyword) like so:

if( options.showDaysOnly ) {
    this.topTags = new Array( 'day','hour', 'minute', 'second' );
    this.loadingTags = [ 'LOAD', 'ING.', '....', '....'];
}
else {
    this.topTags = new Array( 'year', 'month', 'day','hour', 'minute', 'second' );
    this.loadingTags = [ 'LO', 'AD', 'IN', 'G.', '..', '...'];
}

this.transformNames =  [ '-webkit-transform', '-moz-transform', '-o-transform', 'transform' ];

//add the figures, etc to the div
let tagIndex = 0;

for( let tag of this.topTags ) {

    cube = element.append('<section></section>')
               .children(':last')
               .attr('id', tag )
               .addClass( "countdownCubeContainer" )
               .append('<div></div>')
               .children(':last')
               .addClass('countdownCubeCube')
               .data('side', 'show-front');

    /*this is horrible, chaining would be much cooler*/
    this.addFigures( cube,
                     this.classes,
                     this.loadingTags[ tagIndex++ ] );

    element.children(':last')
        .append('<div></div>')
        .children(':last')
        .html(options.labelsTranslations[tag])
        .addClass('countdownCubeTitleDiv');
}

How to replicate? Simply add the 'Array.prototype.distinct' extension to countdowncube.js

Regards,

Edwin

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.