
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
pyrsmk-quark
Advanced tools
Quark is a small javascript library that aims to let you compose your own framework from scratch. It brings a different syntax than the other frameworks which is a lot more intuitive and browser-friendly.
Quark is an alternative to Ender without all the building process and a lot of overhead.
npm install pyrsmk-quark
bower install pyrsmk-quark
As Ender, you'll need to install third-party libraries to add ajax, animations, etc... But it has a basic support for readiness, node selection and creation.
var $ = quark.$,
$$ = quark.$$;
$('.foo .bar').data('state', 'ok');
$$('.comments').css('background', 'red');
Note that data()
and css()
methods are available by installing quarky, a good companion for quark.
Unlike jQuery-like libraries, each node is wrapped by quark and all methods (like css()
) are available. Even into the methods themselves (like on()
in quarky). But you can access to the base node with :
var node = $('.foo').node;
If you need to verify if a node has already been wrapped or not, you can test for :
if('quarked' in somenode) {
// the node is wrapped
}
Quark has a heavy fault tolerance when searched nodes do not exist. Imagine, you have some blog comments that are not there for any reason, then that line won't crash anything :
$('.comments').css('color', 'green');
Quark implements a basic ready function that should work in most browsers :
$(function() {
// Run some tasks when the DOM is ready
});
$()
will return one wrapped node.
$$()
will return a list of wrapped. A forEach()
method has been added to iterate over the nodes.
$$('.comments').forEach(function(index) {
// index is the index of the current node in the list
console.log(index);
// the this keyword points to the current node
this.css('background', 'red');
});
If you want to retrieve an array of nodes instead of an array of wrapped nodes, set true
as second argument (really useful when some library expects an array of nodes) :
var nodes = $$('.comments', true);
You can create on node by calling $()
. The returned node is wrapped as well :
$('body').append($('<div>'));
You can create several nodes too :
var nodes = $$('<div>1</div><div>2</div><div>3</div>');
nodes.css('display', 'inline');
$('body').append(nodes);
Quark is shipped with two base methods : findOne()
and findAll()
.
// Find only one .bar node in .foo nodes
$('.foo').findOne('.bar');
// Find all .bar nodes in .foo nodes
$('.foo').findAll('.bar');
Calling node methods on $$()
will apply the method to each node, as expected. But note that if the method is returning a value then $$()
will return an array of all returned values. Per example :
// Return an array of all .bar nodes found in each .foo node
$$('.foo').findAll('.bar');
Writing extensions is simple, you just have to write code like the example below and release your library on NPM with a quark
tag (so it can easily be found).
Here's the API :
Here's a full example, based on quarky, nut, domReady, morpheus and qwest. First, we configure our framework :
var $ = quark.$,
$$ = quark.$$;
// Set the selector engine
$._selectNode = function(selector) {
return nut(selector)[0];
};
$._selectNodes = nut;
// Set the ready function
$._whenReady = domready;
// Add animation methods
$._nodeMethods.animate = function(options) {
return morpheus(this.node, options);
};
$._nodeMethods.fadeIn = function(duration, func) {
var node = this;
return morpheus(this.node, {
duration : duration,
opacity : 1,
complete : function() {
func.call(node);
}
});
};
$._nodeMethods.fadeOut = function(duration, func) {
var node = this;
return morpheus(this.node, {
duration : duration,
opacity : 0,
complete : function() {
func.call(node);
}
});
};
// Add an ajax method to the front object
$.ajax = qwest;
Now that the framework is set, we can use it :
// When the DOM is ready
$(function() {
// Animate images in .foo containers
this.on('click', function() {
this.findAll('img').fadeIn();
});
// Run a GET ajax request
$.ajax.get('example.com')
.then(function(xhr, response) {
$('#info').html(response);
});
});
Quark is published under the MIT license.
FAQs
Another micro-framework
We found that pyrsmk-quark 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.