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

gamma-grid

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gamma-grid - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

16

app.js

@@ -32,2 +32,3 @@ var bogart = require('bogart');

var take = parseInt(req.params.take) || 5;
var search = req.params.search;

@@ -38,5 +39,12 @@ var returnData= data.sort (function(a,b ){

var count = data.length;
returnData= data.slice(skip, skip + take);
if (search){
returnData = returnData.filter(function(item){
return item.name.toLowerCase().indexOf(search.toLowerCase()) > -1;
});
}
var count = returnData.length;
returnData= returnData.slice(skip, skip + take);
return bogart.json({sort:sortBy, pageSize:take, start:skip+1, end: skip + returnData.length, count:count, results:returnData});

@@ -61,5 +69,5 @@ });

var app = bogart.app();
app.use(bogart.batteries); // A batteries included JSGI stack including streaming request body parsing, session, flash, and much more.
app.use(bogart.batteries({secret:"ASDFLKJASDF"})); // A batteries included JSGI stack including streaming request body parsing, session, flash, and much more.
app.use(router); // Our router
app.start();
app.start({port:1337});
{
"name": "gamma-grid",
"version": "0.0.3",
"directories": {
"lib": "./src"
},
"main": "./lib/app.js",
"author": "Whiteboard-IT",
"dependencies": {
"bogart": ">=0.1.4",
"mustache": "~0.8.1"
}
}
"name": "gamma-grid",
"version": "0.0.4",
"directories": {
"lib": "./src"
},
"main": "./lib/app.js",
"author": "Whiteboard-IT",
"dependencies": {
"bogart": ">=0.5.15",
"mustache": "~0.8.1"
}
}

@@ -42,7 +42,12 @@ /* Permission is hereby granted, free of charge, to any person obtaining

}
return "?" + query;
if (query.lastIndexOf("&") == query.length-1){
query = query.substring(0, query.length);
}
return query;
}
function queryToHash(query) {
query = query.substring(1);
if (query.indexOf("?") === 0){
query = query.substring(1);
}
var hash = {};

@@ -64,6 +69,6 @@ var pairs = query.split("&");

queryHash.skip = end;
var next = (end < count) ? "<a href='" + hashToQuery(queryHash) + "'>Next&nbsp;&mdash;&gt;</a>" : "";
var next = (end < count) ? "<a href='?" + hashToQuery(queryHash) + "'>Next&nbsp;&mdash;&gt;</a>" : "";
queryHash.skip = start - options.pageSize - 1;
queryHash.skip = queryHash.skip < 0 ? 0 : queryHash.skip;
var prev = start !== 1 ? "<a href='" + hashToQuery(queryHash) + "'>&lt;&mdash;&nbsp;Previous </a>" : "";
var prev = start !== 1 ? "<a href='?" + hashToQuery(queryHash) + "'>&lt;&mdash;&nbsp;Previous </a>" : "";
if (end == 0) {

@@ -83,2 +88,3 @@ return "<div class='gammaPager'>No Results</div>";

query = query || window.location.search;
query = query.replace("?", "");
var queryHash = queryToHash(query);

@@ -90,3 +96,4 @@

grid.append(loadingDiv);
$.ajax(dataUrl + query, {
var url = dataUrl + (dataUrl.indexOf("?") > -1 ? "&" + query : "?" + query);
$.ajax(url, {
method: "GET",

@@ -109,2 +116,6 @@ dataType: "json",

$(this).parent().find('input').val('');
delete queryHash['search'];
query = hashToQuery(queryHash);
window.location.search = query;
context.load(query);
});

@@ -111,0 +122,0 @@ grid.html("<form class='gammaSearch'><input type='text' name='search'" + searchValue + " placeholder='Search...' class='gammaSearchField'/><span class='clearText'>x</span></form>");

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