mirror of
https://github.com/wassname/keywordshitter2.git
synced 2026-07-17 11:29:07 +08:00
Refactored, working again
This commit is contained in:
+14
-8
@@ -46,7 +46,7 @@ on purpose
|
||||
dismantled my
|
||||
lying internet</textarea>
|
||||
</div>
|
||||
<a class="btn btn-primary btn-lg" id="startjob" onclick="StartJob();" type="button" value="Shit Keywords!">Shit Keywords!</a>
|
||||
<a class="btn btn-primary btn-lg" id="startjob" type="button" value="Shit Keywords!">Shit Keywords!</a>
|
||||
|
||||
|
||||
<button class="btn btn-default" type="button" data-toggle="collapse" data-target="#advanced" aria-expanded="false" aria-controls="advanced">
|
||||
@@ -57,12 +57,12 @@ lying internet</textarea>
|
||||
About
|
||||
</button>
|
||||
|
||||
<a class="btn btn-default" id="reset" title="Empty all input and results" onclick="reset();" type="button" value="Reset">Reset</a>
|
||||
<a class="btn btn-default" id="reset" title="Empty all input and results" type="button" value="Reset">Reset</a>
|
||||
|
||||
<form id="advanced" class="collapse">
|
||||
<br>
|
||||
<a class="btn btn-default" id="load-from-cache" title="Load cached data from previous sessions" onclick="loadFromDB();" type="button" value="load">Load cache</a>
|
||||
<a class="btn btn-default" id="export-from-cache" title="Export cached data from previous sessions as a json file" onclick="exportDB();" type="button" value="load">Export cache</a>
|
||||
<a class="btn btn-default" id="load-from-cache" title="Load cached data from previous sessions" type="button" value="load">Load cache</a>
|
||||
<a class="btn btn-default" id="export-from-cache" title="Export cached data from previous sessions as a json file" type="button" value="load">Export cache</a>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service">Service:</label>
|
||||
@@ -395,16 +395,22 @@ lying internet</textarea>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="filter-positive" >Positive filter:</label>
|
||||
<textarea disabled id="filter-positive" name="filter-positive" class="form-control" rows="3" onkeyup="FilterIfNotWorking()"
|
||||
<textarea disabled id="filter-positive" name="filter-positive" class="form-control" rows="3"
|
||||
placeholder="Positive Filter"></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="filter-negative">Negative filter:</label>
|
||||
<textarea disabled id="filter-negative" name="filter-negative" class="form-control" rows="3" onkeyup="FilterIfNotWorking()" placeholder="Negative Filter"></textarea>
|
||||
<textarea disabled id="filter-negative" name="filter-negative" class="form-control" rows="3"placeholder="Negative Filter"></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="rate-limit">Rate limit (for experts):</label>
|
||||
<input type="text" class="form-control" id="rate-limit" value="750" name="rate-limit" title="OValue between searches in milliseconds only change if you know what you are doing. This could get your ip banned, or place an unfair burden on the suggest servers." disabled>
|
||||
<input type="text" class="form-control" id="rate-limit" value="2000" name="rate-limit" title="Value between searches in milliseconds only change if you know what you are doing. This could get your ip banned, or place an unfair burden on the suggest servers." disabled>
|
||||
</div>
|
||||
|
||||
<div class="checkbox">
|
||||
<label for="keep-running">
|
||||
<input type="checkbox" id="keep-running" name="keep-running" title="Keep running forever"></input>Continuous running:
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
@@ -475,7 +481,7 @@ lying internet</textarea>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
kws2Init();
|
||||
KWS.init();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
+754
-681
File diff suppressed because it is too large
Load Diff
+30
-11
@@ -1,10 +1,29 @@
|
||||
var expect = chai.expect;
|
||||
var assert = chai.assert;
|
||||
|
||||
// TODO describe('permute', function(){
|
||||
// it('should correctly permute results and add to queue', function() {
|
||||
// });
|
||||
// });
|
||||
// TODO
|
||||
describe('permute', function(){
|
||||
before(function() {
|
||||
KWS.hashMapInputs = {};
|
||||
KWS.keywordsToQuery = [];
|
||||
});
|
||||
|
||||
after(function() {
|
||||
KWS.hashMapInputs = {};
|
||||
KWS.keywordsToQuery = [];
|
||||
});
|
||||
|
||||
it('should correctly permute results and add to queue', function() {
|
||||
var retList = ['a','b','c d',' a longer one'];
|
||||
KWS.permuteResultsToQueue(retList,'test');
|
||||
assert(KWS.keywordsToQuery.length>0);
|
||||
assert(KWS.hashMapInputs['b']);
|
||||
assert(KWS.hashMapInputs['test']);
|
||||
// var options = KWS.getOptions();
|
||||
// var expectedLength = options.prefixes.length*retList.length+options.suffixes.length*retList.length
|
||||
// assert(KWS.keywordsToQuery.length==expectedLength,''+expectedLength+'!='+KWS.keywordsToQuery.length);
|
||||
});
|
||||
});
|
||||
|
||||
// TODO use localForage or most popular promise wrapper for indexedDB then test
|
||||
// describe('exportDB', function(){
|
||||
@@ -12,7 +31,7 @@ var assert = chai.assert;
|
||||
|
||||
describe('db', function() {
|
||||
it('should correctly set up db', function(done) {
|
||||
var dbReq=setUpDb();
|
||||
var dbReq=KWS.setUpDb();
|
||||
var oldonsuccess=dbReq.onsuccess;
|
||||
dbReq.onsuccess=function(event){
|
||||
// override onld onsucess because it doesn't use promises
|
||||
@@ -33,7 +52,7 @@ describe('extractDomain', function(){
|
||||
if (testData.domainUrls.hasOwnProperty(expectedDomain)) {
|
||||
it('should correctly extract domain from url, domain='+expectedDomain, function() {
|
||||
var url = testData.domainUrls[expectedDomain];
|
||||
var domain = extractDomain(url);
|
||||
var domain = KWS.extractDomain(url);
|
||||
assert.equal(expectedDomain,domain);
|
||||
});
|
||||
}
|
||||
@@ -48,7 +67,7 @@ describe('responses', function(){
|
||||
it('should correctly parse test data for service='+service, function() {
|
||||
var res = testData.responses[service];
|
||||
var options = {service:service};
|
||||
var parsedRes = parseServiceResponse(res,options);
|
||||
var parsedRes = KWS.parseServiceResponse(res,options);
|
||||
|
||||
assert.typeOf(parsedRes,'array');
|
||||
expect(parsedRes).to.have.length.above(1);
|
||||
@@ -82,7 +101,7 @@ describe('services', function() {
|
||||
searches.forEach(function(search){
|
||||
it('should correctly get and parse data'+'. Service="'+service+'" search="'+search+'"', function(done) {
|
||||
var options = {service:service};
|
||||
var url = getUrl(options)+search;
|
||||
var url = KWS.getUrl(options)+search;
|
||||
return $.ajax({
|
||||
url: url,
|
||||
async: false,
|
||||
@@ -91,7 +110,7 @@ describe('services', function() {
|
||||
success: function (res, statusText, jqXHR) {
|
||||
assert(statusText=="success");
|
||||
assert(res!==[]);
|
||||
var parsedRes = parseServiceResponse(res,options);
|
||||
var parsedRes = KWS.parseServiceResponse(res,options);
|
||||
assert.typeOf(parsedRes,'array');
|
||||
parsedRes.map(r => assert.typeOf(r, 'string'));
|
||||
done();
|
||||
@@ -110,7 +129,7 @@ describe('services', function() {
|
||||
searchesDifficult.forEach(function(search){
|
||||
it('should get and parse difficult data'+'. Service="'+service+'" search="'+search+'"', function(done) {
|
||||
var options = {service:service};
|
||||
var url = getUrl(options)+search;
|
||||
var url = KWS.getUrl(options)+search;
|
||||
return $.ajax({
|
||||
url: url,
|
||||
async: false,
|
||||
@@ -120,7 +139,7 @@ describe('services', function() {
|
||||
assert(statusText=="success");
|
||||
assert(res!==[]);
|
||||
|
||||
var parsedRes = parseServiceResponse(res,options);
|
||||
var parsedRes = KWS.parseServiceResponse(res,options);
|
||||
assert.typeOf(parsedRes,'array');
|
||||
parsedRes.map(r => assert.typeOf(r, 'string'));
|
||||
return done();
|
||||
|
||||
Reference in New Issue
Block a user