![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Tired of writing the same old lightbox implementation for every new project? Yeah, me too. That's why I decided to do it right for once and write a proper implementation that encourages reuse and extension.
At the moment, Darkbox is only available on npm, so you'll require a buildtool such as browserify in order to use it. Will happily accept pull requests for other environments though!
$ npm install --save darkbox
Then in your javascript code:
var Darkbox = require('darkbox');
var darkbox = new Darkbox(options);
darkbox.open(type, typeOptions);
Nowadays, all types of content are loaded into lightboxes in order to maintain a nice user experience. As a result of this, many lightbox implementations have become rather bloated and are starting to feel sluggish. To avoid this, Darkbox is set up in a way that new types are easily added, whether they are included in the Darkbox distribution or not.
Reusable ones will be added to core for easy inclusion, but you will have to manually include them, to avoid the scenario described above.
Including handler functions for custom types couldn't be easier! For an example,
view the types/youtube.js
file. To make that handler execute, we could do:
var Darkbox = require('darkbox');
require('darkbox/types/youtube');
var darkbox = new Darkbox();
darkbox.open('youtube', {
id: 'dQw4w9WgXcQ',
width: 560,
height: 315
});
As you can see, all we had to do is require('darkbox/types/youtube')
and the
handler registered itself to be usable. To create your own handler you could do
something very similar:
var Darkbox = require('darkbox');
Darkbox.types.myType = function(opts){};
That's it!
The opts
object gets passed through from the darkbox.open
call that
triggered it, so you can decide for yourself what options you desire.
this
within that function would point to the instance of darkbox
that triggered the handler, so you have easy access to utility methods such as
fit
, empty
and renderControls
.
The MIT License (MIT)
Copyright (c) 2015 Chiel Kunkels
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
An extensible, pluggable lightbox
The npm package darkbox receives a total of 0 weekly downloads. As such, darkbox popularity was classified as not popular.
We found that darkbox demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.