Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

galiria

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

galiria - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

build.sh

2

bower.json
{
"name": "galiria",
"description": "minimal image gallery",
"main": "index.js",
"main": "build/galiria.js",
"authors": [

@@ -6,0 +6,0 @@ "Armando Magalhães <armando.mag95@gmail.com> (http://armand1m.herokuapp.com)"

{
"name": "galiria",
"version": "1.0.1",
"version": "1.0.2",
"description": "minimal image gallery",

@@ -25,4 +25,4 @@ "main": "index.js",

"devDependencies": {
"gulp": "^3.9.0"
"grunt": "^0.4.5"
}
}

@@ -1,7 +0,18 @@

window.Galiria = (function(options) {
module.exports = function Galiria() {
'use strict';
var instance = _createContainerInstance();
/** @const instance Instance of Galiria, a Singleton. */
var instance;
function _figureOnClick(e) {
/**
* must clone de <figure> element from the DOM
* add de .galiria__container__figure element class on it
* and append it on .galiria__container element class.
*
* also, set the modifier class .galiria__container--active on
* .galiria__container element class.
*
* @param Event e Event when clickin on the image.
*/
function _imageOnClick(e) {
var figure = e.target.parentNode.cloneNode(true);

@@ -20,2 +31,11 @@ figure.classList.add('galiria__container__figure');

/**
* should remove the figure from the DOM
* and from the {@var instance}.
*
* also removes the .galiria__container--active modifier class
* from the container in {@var instance}.
*
* @param Event e Event when clickin on container.
*/
function _containerOnClick(e) {

@@ -30,3 +50,9 @@ if (instance.figure) {

function _createContainerInstance() {
/**
* create a instance object with a container
* and a list (the element with '.galiria' block class)
*
* @return instance An object with container DOM element, and a list
*/
function _createInstance() {
var docFrag = document.createDocumentFragment()

@@ -46,2 +72,8 @@ , container = _createContainerElement()

/**
* creates a <div>, which will have a class .galiria__container
* and a event listener on click.
*
* @return HTMLDivElement A div with .galiria__container element class
*/
function _createContainerElement() {

@@ -56,13 +88,20 @@ var container = document.createElement("div");

function _setFigureEvents() {
for (var i = instance.list.children.length; i--;) {
instance.list.children[i].addEventListener('click', _figureOnClick);
}
/**
* set event listeners on all the childrens
* of {@var instance.list}, the '<figure>' tags.
*/
function _setImageEvents() {
for (var i = instance.list.children.length; i--;)
instance.list.children[i].children[0].addEventListener('click', _imageOnClick);
}
/**
* actually initialize the Galiria
*/
function init() {
_setFigureEvents();
instance = _createInstance();
_setImageEvents();
}
init();
})();
};

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc