<commit_before>// Variety.js v3.4.1
/* jshint latedef: false */
/* global pzpr:false */

(function(){

var _info = {}, _list = [];
function toPID(name){
	if(!!_info[name]){ return name;}
	for(var pid in _info){
		if(!_info[pid].alias){ continue;}
		for(var type in _info[pid].alias){
			if(_info[pid].alias[type]===name){ return pid;}
		}
	}
	return '';
}

var variety = pzpr.variety = pzpr.genre = function(pid){
	return _info[toPID(pid)] || {valid:false};
};
variety.extend = function(obj){ for(var n in obj){ this[n] = obj[n];}};
variety.extend({
	info   : _info,
	toPID  : toPID,
	exists : function(name){
		return variety(name).valid;
	},
	each : function(func){
		for(var pid in _info){ func(pid);}
	},
	getList : function(){
		return _list.slice();
	}
});
delete variety.extend;

(function(Genre, obj){
	for(var pzprid in obj){
		_info[pzprid] = new Genre(pzprid,obj[pzprid]);
		try{
			Object.freeze(_info[pzprid]);
			Object.freeze(_info[pzprid].exists);
			Object.freeze(_info[pzprid].alias);
		}catch(e){}
	}
})
(function Genre(pzprid, datalist){
	this.valid  = true;
	this.pid    = pzprid;		/* パズルID */
	this.script = (!!datalist[4] ? datalist[4] : pzprid);	/* スクリプトファイル(クラス) */
	this.ja     = datalist[2];	/* 日本語パズル名 */
	this.en     = datalist[3];	/* 英語パズル名 */
	this.exists = {
		pzprapp : !!datalist[0],
		kanpen  : !!datalist[1],
		pencilbox : !!datalist[1]
	};
	this.exists.pencilbox = this.exists.pencilbox &&
						 (pzprid!=="nanro" && pzprid!=="ayeheya" && pzprid!=="kurochute");
	/* pzprurl : ぱずぷれID(URL出力用) */
	/* kanpen  : カンペンID            */
	/* kanpen2 : カンペンID(入力のみ)  */
	this.alias  = (!!datalist[5] ? datalist[5] : {});
	this.urlid  = this.alias.pzprurl || pzprid;
	this.kanpenid = (!!datalist[1] ? (this.alias.kanpen  || pzprid) : '');
	_list.push(pzprid);
},
{
	aho       :[0,0,"アホになり切れ","Aho-ni-Narikire",'shikaku'],
	amibo     :[0,0,"あみぼー","Amibo",'amibo'],
	arukone   :[0,0,"アルコネ","Arukone",'numlin'],
	ayeheya   :[0,1,"∀人∃ＨＥＹＡ","ekawayeh",'heyawake'],
	bag       :[1,0,"バッグ","BAG (Corral)",'slither',{alias:'correl',alias2:'cave'}],
	barns     :[1,0,"バーンズ","Barns"],
	bdblock   :[1,0,"ボーダーブロック","Border Block"],
	bonsan    :[1,0,"ぼんさん","Bonsan",'bonsan'],
	bosanowa  :[1,0,"ボサノワ","Bosanowa",'',{alias:'bossanova'}],
	box       :[0,0,"ボックス","Box"],
	building  :[0,0,"ビルディングパズル","Skyscrapers",'',{alias:'skyscrapers',alias2:'skyscraper'}],
	cbblock   :[0,0,"コンビブロック","Combi Block"],
	chocona   :[0,0,"チョコナ","Chocona",'shimaguni'],
	cojun     :[0,0,"コージュン","Cojun",'ripple'],
	country   :[1,0,"カントリーロード","Country Road"],
	creek     :[1,0,"クリーク","Creek"],
	dosufuwa  :[0,0,"ドッスンフワリ","Dosun-Fuwari"],
	easyasabc :[0,0,"ABCプレース","Easy as ABC"],
	factors   :[0,0,"因子の部屋","Rooms of Factors"],
	fillmat   :[1,0,"フィルマット","Fillmat",'fillmat'],
	fillomino :[0,1,"フィルオミノ","Fillomino",'',{kanpen2:'fillomino01'}],
	firefly   :[1,0,"ホタルビーム","Hotaru Beam (Glow of Fireflies)"],
	fivecells :[0,0,"ファイブセルズ","FiveCells",'nawabari'],
	fourcells :[0,0,"フォーセルズ","FourCells",'nawabari'],
	goishi    :[0,1,"碁石ひろい","Goishi"],
	gokigen   :[1,0,"ごきげんななめ","Gokigen-naname (Slalom, Slant)",'gokigen'],
	hakoiri   :[1,0,"はこいり○△□","Hokoiri-masashi"],
	hanare    :[0,0,"はなれ組","Hanare-gumi",'hanare'],
	hashikake :[0,1,"橋をかけろ","Hashiwokakero (Bridges)",'',{pzprurl:'hashi',kanpen:'hashi',alias:'bridges'}],
	hebi      :[1,0,"へびいちご","Hebi-Ichigo",'',{old:'snakes'}],
	herugolf  :[0,0,"ヘルゴルフ","Herugolf"],
	heyawake  :[0,1,"へやわけ","Heyawake",'heyawake'],
	heyabon   :[1,1,"へやぼん","Heya-Bon",'bonsan',{kanpen:'satogaeri'}],
	hitori    :[0,1,"ひとりにしてくれ","Hitori"],
	icebarn   :[1,0,"アイスバーン","Icebarn",'icebarn'],
	icelom    :[0,0,"アイスローム","Icelom",'icebarn'],
	icelom2   :[0,0,"アイスローム２","Icelom2",'icebarn'],
	ichimaga  :[0,0,"イチマガ","Ichimaga",'ichimaga'],
	ichimagam :[0,0,"磁石イチマガ","Magnetic Ichimaga",'ichimaga'],
	ichimagax :[0,0,"一回曲がって交差もするの","Crossing Ichimaga",'ichimaga'],
	juosan    :[0,0,"縦横さん","Juosan"],
	kazunori  :[0,0,"かずのりのへや","Kazunori Room"],
	kaero     :[1,0,"お家に帰ろう","Return Home"],
	kakuro    :[0,1,"カックロ","Kakuro"],
	kakuru    :[0,0,"カックル","Kakuru"],
	kinkonkan :[1,0,"キンコンカン","Kin-Kon-Kan"],
	kouchoku  :[0,0,"交差は直角に限る","Kouchoku"],
	kramma    :[0,0,"快刀乱麻","KaitoRamma",'kramma'],
	kramman   :[0,0,"新・快刀乱麻","New KaitoRamma",'kramma'],
	kropki    :[0,0,"Kropki","Kropki",'minarism'],
	kurochute :[0,1,"クロシュート","Kurochute"],
	kurodoko  :[0,1,"黒どこ(黒マスはどこだ)","Kurodoko"],
	kurotto   :[0,0,"クロット","Kurotto"],
	kusabi    :[0,0,"クサビリンク","Kusabi"],
	lightup   :[0,1,"美術館","Akari (Light Up)",'',{pzprurl:'akari',kanpen:'bijutsukan'}],
	lits      :[1,1,"ＬＩＴＳ","LITS",'lits'],
	lookair   :[0,0,"るっくえあ","Look-Air"],
	loopsp    :[1,0,"環状線スペシャル","Loop Special",'pipelink'],
	loute     :[0,0,"エルート","L-route"],
	makaro    :[0,0,"マカロ","Makaro"],
	mashu     :[0,1,"ましゅ","Masyu (Pearl Puzzle)",'',{kanpen:'masyu',alias:'pearl'}],
	mejilink  :[0,0,"メジリンク","Mejilink"],
	minarism  :[1,0,"マイナリズム","Minarism"],
	mochikoro :[1,0,"モチコロ","Mochikoro",'nurikabe'],
	mochinyoro:[1,0,"モチにょろ","Mochinyoro",'nurikabe'],
	moonsun   :[0,0,"月か太陽","Moon or Sun",'country'],
	nagare    :[0,0,"流れるループ","Nagareru-Loop"],
	nagenawa  :[0,0,"なげなわ","Nagenawa",'nagenawa'],
	nanro     :[0,1,"ナンロー","Nanro"],
	nawabari  :[1,0,"なわばり","Territory",'nawabari'],
	nondango  :[0,0,"ノンダンゴ","Nondango"],
	norinori  :[0,1,"のりのり","Norinori",'lits'],
	numlin    :[0,1,"ナンバーリンク","Numberlink",'',{kanpen:'numberlink'}],
	nuribou   :[1,0,"ぬりぼう","Nuribou",'nurikabe'],
	nurikabe  :[0,1,"ぬりかべ","Nurikabe",'nurikabe'],
	nurimaze  :[0,0,"ぬりめいず","Nuri-Maze",'nurimaze'],
	onsen     :[0,0,"温泉めぐり","Onsen-meguri",'country'],
	paintarea :[1,0,"ペイントエリア","Paintarea"],
	pipelink  :[1,0,"パイプリンク","Pipelink",'pipelink'],
	pipelinkr :[1,0,"帰ってきたパイプリンク","Pipelink Returns",'pipelink'],
	rectslider:[0,0,"四角スライダー","Rectangle-Slider",'bonsan'],
	reflect   :[1,0,"リフレクトリンク","Reflect Link"],
	renban    :[0,0,"連番窓口","Renban-Madoguchi"],
	ringring  :[0,0,"リングリング","Ring-ring",'nagenawa'],
	ripple    :[0,1,"波及効果","Ripple Effect",'ripple',{kanpen:'hakyukoka'}],
	roma      :[0,0,"ろーま","Roma",'',{alias:'rome'}],
	sashigane :[0,0,"さしがね","Sashigane",'loute'],
	shakashaka:[0,1,"シャカシャカ","ShakaShaka"],
	shikaku   :[0,1,"四角に切れ","Shikaku (Divide by Box)",'shikaku'],
	shimaguni :[1,0,"島国","Islands",'shimaguni'],
	shugaku   :[1,0,"修学旅行の夜","School Trip"],
	shwolf    :[0,0,"ヤギとオオカミ","Sheeps and Wolves",'kramma'],
	slalom    :[1,1,"スラローム","Slalom (Suraromu)",'',{alias:'suraromu'}],
	slither   :[0,1,"スリザーリンク","Slitherlink",'',{kanpen:'slitherlink'}],
	starbattle:[0,0,"スターバトル","Star Battle"],
	stostone  :[0,0,"ストストーン","Stostone",'shimaguni'],
	sudoku    :[0,1,"数独","Sudoku"],
	sukoro    :[1,0,"数コロ","Sukoro",'sukoro'],
	sukororoom:[0,0,"数コロ部屋","Sukoro-room",'sukoro'],
	tapa      :[0,0,"Tapa","Tapa"],
	tasquare  :[0,0,"たすくえあ","Tasquare"],
	tatamibari:[1,0,"タタミバリ","Tatamibari"],
	tateyoko  :[1,0,"タテボーヨコボー","Tatebo-Yokobo"],
	tawa      :[0,0,"たわむれんが","Tawamurenga"],
	tentaisho :[0,1,"天体ショー","Tentaisho"],
	tilepaint :[1,0,"タイルペイント","Tilepaint"],
	toichika  :[0,0,"遠い誓い","Toichika"],
	triplace  :[0,0,"トリプレイス","Tri-place"],
	usotatami :[0,0,"ウソタタミ","Uso-tatami",'fillmat'],
	usoone    :[0,0,"ウソワン","Uso-one"],
	view      :[1,0,"ヴィウ","View",'sukoro'],
	wagiri    :[0,0,"ごきげんななめ・輪切","Gokigen-naname:wagiri",'gokigen'],
	wblink    :[0,0,"シロクロリンク","Shirokuro-link"],
	yajikazu  :[1,0,"やじさんかずさん","Yajisan-Kazusan"],
	yajirin   :[0,1,"ヤジリン","Yajilin",'',{pzprurl:'yajilin',kanpen:'yajilin'}],
	yajitatami:[0,0,"ヤジタタミ","Yajitatami"],
	yinyang   :[0,0,"しろまるくろまる","Yin-Yang"],
	yosenabe  :[0,0,"よせなべ","Yosenabe"]
});

})();
<commit_msg>variety: Fix "Goats and Wolves" name<commit_after>// Variety.js v3.4.1
/* jshint latedef: false */
/* global pzpr:false */

(function(){

var _info = {}, _list = [];
function toPID(name){
	if(!!_info[name]){ return name;}
	for(var pid in _info){
		if(!_info[pid].alias){ continue;}
		for(var type in _info[pid].alias){
			if(_info[pid].alias[type]===name){ return pid;}
		}
	}
	return '';
}

var variety = pzpr.variety = pzpr.genre = function(pid){
	return _info[toPID(pid)] || {valid:false};
};
variety.extend = function(obj){ for(var n in obj){ this[n] = obj[n];}};
variety.extend({
	info   : _info,
	toPID  : toPID,
	exists : function(name){
		return variety(name).valid;
	},
	each : function(func){
		for(var pid in _info){ func(pid);}
	},
	getList : function(){
		return _list.slice();
	}
});
delete variety.extend;

(function(Genre, obj){
	for(var pzprid in obj){
		_info[pzprid] = new Genre(pzprid,obj[pzprid]);
		try{
			Object.freeze(_info[pzprid]);
			Object.freeze(_info[pzprid].exists);
			Object.freeze(_info[pzprid].alias);
		}catch(e){}
	}
})
(function Genre(pzprid, datalist){
	this.valid  = true;
	this.pid    = pzprid;		/* パズルID */
	this.script = (!!datalist[4] ? datalist[4] : pzprid);	/* スクリプトファイル(クラス) */
	this.ja     = datalist[2];	/* 日本語パズル名 */
	this.en     = datalist[3];	/* 英語パズル名 */
	this.exists = {
		pzprapp : !!datalist[0],
		kanpen  : !!datalist[1],
		pencilbox : !!datalist[1]
	};
	this.exists.pencilbox = this.exists.pencilbox &&
						 (pzprid!=="nanro" && pzprid!=="ayeheya" && pzprid!=="kurochute");
	/* pzprurl : ぱずぷれID(URL出力用) */
	/* kanpen  : カンペンID            */
	/* kanpen2 : カンペンID(入力のみ)  */
	this.alias  = (!!datalist[5] ? datalist[5] : {});
	this.urlid  = this.alias.pzprurl || pzprid;
	this.kanpenid = (!!datalist[1] ? (this.alias.kanpen  || pzprid) : '');
	_list.push(pzprid);
},
{
	aho       :[0,0,"アホになり切れ","Aho-ni-Narikire",'shikaku'],
	amibo     :[0,0,"あみぼー","Amibo",'amibo'],
	arukone   :[0,0,"アルコネ","Arukone",'numlin'],
	ayeheya   :[0,1,"∀人∃ＨＥＹＡ","ekawayeh",'heyawake'],
	bag       :[1,0,"バッグ","BAG (Corral)",'slither',{alias:'correl',alias2:'cave'}],
	barns     :[1,0,"バーンズ","Barns"],
	bdblock   :[1,0,"ボーダーブロック","Border Block"],
	bonsan    :[1,0,"ぼんさん","Bonsan",'bonsan'],
	bosanowa  :[1,0,"ボサノワ","Bosanowa",'',{alias:'bossanova'}],
	box       :[0,0,"ボックス","Box"],
	building  :[0,0,"ビルディングパズル","Skyscrapers",'',{alias:'skyscrapers',alias2:'skyscraper'}],
	cbblock   :[0,0,"コンビブロック","Combi Block"],
	chocona   :[0,0,"チョコナ","Chocona",'shimaguni'],
	cojun     :[0,0,"コージュン","Cojun",'ripple'],
	country   :[1,0,"カントリーロード","Country Road"],
	creek     :[1,0,"クリーク","Creek"],
	dosufuwa  :[0,0,"ドッスンフワリ","Dosun-Fuwari"],
	easyasabc :[0,0,"ABCプレース","Easy as ABC"],
	factors   :[0,0,"因子の部屋","Rooms of Factors"],
	fillmat   :[1,0,"フィルマット","Fillmat",'fillmat'],
	fillomino :[0,1,"フィルオミノ","Fillomino",'',{kanpen2:'fillomino01'}],
	firefly   :[1,0,"ホタルビーム","Hotaru Beam (Glow of Fireflies)"],
	fivecells :[0,0,"ファイブセルズ","FiveCells",'nawabari'],
	fourcells :[0,0,"フォーセルズ","FourCells",'nawabari'],
	goishi    :[0,1,"碁石ひろい","Goishi"],
	gokigen   :[1,0,"ごきげんななめ","Gokigen-naname (Slalom, Slant)",'gokigen'],
	hakoiri   :[1,0,"はこいり○△□","Hokoiri-masashi"],
	hanare    :[0,0,"はなれ組","Hanare-gumi",'hanare'],
	hashikake :[0,1,"橋をかけろ","Hashiwokakero (Bridges)",'',{pzprurl:'hashi',kanpen:'hashi',alias:'bridges'}],
	hebi      :[1,0,"へびいちご","Hebi-Ichigo",'',{old:'snakes'}],
	herugolf  :[0,0,"ヘルゴルフ","Herugolf"],
	heyawake  :[0,1,"へやわけ","Heyawake",'heyawake'],
	heyabon   :[1,1,"へやぼん","Heya-Bon",'bonsan',{kanpen:'satogaeri'}],
	hitori    :[0,1,"ひとりにしてくれ","Hitori"],
	icebarn   :[1,0,"アイスバーン","Icebarn",'icebarn'],
	icelom    :[0,0,"アイスローム","Icelom",'icebarn'],
	icelom2   :[0,0,"アイスローム２","Icelom2",'icebarn'],
	ichimaga  :[0,0,"イチマガ","Ichimaga",'ichimaga'],
	ichimagam :[0,0,"磁石イチマガ","Magnetic Ichimaga",'ichimaga'],
	ichimagax :[0,0,"一回曲がって交差もするの","Crossing Ichimaga",'ichimaga'],
	juosan    :[0,0,"縦横さん","Juosan"],
	kazunori  :[0,0,"かずのりのへや","Kazunori Room"],
	kaero     :[1,0,"お家に帰ろう","Return Home"],
	kakuro    :[0,1,"カックロ","Kakuro"],
	kakuru    :[0,0,"カックル","Kakuru"],
	kinkonkan :[1,0,"キンコンカン","Kin-Kon-Kan"],
	kouchoku  :[0,0,"交差は直角に限る","Kouchoku"],
	kramma    :[0,0,"快刀乱麻","KaitoRamma",'kramma'],
	kramman   :[0,0,"新・快刀乱麻","New KaitoRamma",'kramma'],
	kropki    :[0,0,"Kropki","Kropki",'minarism'],
	kurochute :[0,1,"クロシュート","Kurochute"],
	kurodoko  :[0,1,"黒どこ(黒マスはどこだ)","Kurodoko"],
	kurotto   :[0,0,"クロット","Kurotto"],
	kusabi    :[0,0,"クサビリンク","Kusabi"],
	lightup   :[0,1,"美術館","Akari (Light Up)",'',{pzprurl:'akari',kanpen:'bijutsukan'}],
	lits      :[1,1,"ＬＩＴＳ","LITS",'lits'],
	lookair   :[0,0,"るっくえあ","Look-Air"],
	loopsp    :[1,0,"環状線スペシャル","Loop Special",'pipelink'],
	loute     :[0,0,"エルート","L-route"],
	makaro    :[0,0,"マカロ","Makaro"],
	mashu     :[0,1,"ましゅ","Masyu (Pearl Puzzle)",'',{kanpen:'masyu',alias:'pearl'}],
	mejilink  :[0,0,"メジリンク","Mejilink"],
	minarism  :[1,0,"マイナリズム","Minarism"],
	mochikoro :[1,0,"モチコロ","Mochikoro",'nurikabe'],
	mochinyoro:[1,0,"モチにょろ","Mochinyoro",'nurikabe'],
	moonsun   :[0,0,"月か太陽","Moon or Sun",'country'],
	nagare    :[0,0,"流れるループ","Nagareru-Loop"],
	nagenawa  :[0,0,"なげなわ","Nagenawa",'nagenawa'],
	nanro     :[0,1,"ナンロー","Nanro"],
	nawabari  :[1,0,"なわばり","Territory",'nawabari'],
	nondango  :[0,0,"ノンダンゴ","Nondango"],
	norinori  :[0,1,"のりのり","Norinori",'lits'],
	numlin    :[0,1,"ナンバーリンク","Numberlink",'',{kanpen:'numberlink'}],
	nuribou   :[1,0,"ぬりぼう","Nuribou",'nurikabe'],
	nurikabe  :[0,1,"ぬりかべ","Nurikabe",'nurikabe'],
	nurimaze  :[0,0,"ぬりめいず","Nuri-Maze",'nurimaze'],
	onsen     :[0,0,"温泉めぐり","Onsen-meguri",'country'],
	paintarea :[1,0,"ペイントエリア","Paintarea"],
	pipelink  :[1,0,"パイプリンク","Pipelink",'pipelink'],
	pipelinkr :[1,0,"帰ってきたパイプリンク","Pipelink Returns",'pipelink'],
	rectslider:[0,0,"四角スライダー","Rectangle-Slider",'bonsan'],
	reflect   :[1,0,"リフレクトリンク","Reflect Link"],
	renban    :[0,0,"連番窓口","Renban-Madoguchi"],
	ringring  :[0,0,"リングリング","Ring-ring",'nagenawa'],
	ripple    :[0,1,"波及効果","Ripple Effect",'ripple',{kanpen:'hakyukoka'}],
	roma      :[0,0,"ろーま","Roma",'',{alias:'rome'}],
	sashigane :[0,0,"さしがね","Sashigane",'loute'],
	shakashaka:[0,1,"シャカシャカ","ShakaShaka"],
	shikaku   :[0,1,"四角に切れ","Shikaku (Divide by Box)",'shikaku'],
	shimaguni :[1,0,"島国","Islands",'shimaguni'],
	shugaku   :[1,0,"修学旅行の夜","School Trip"],
	shwolf    :[0,0,"ヤギとオオカミ","Goats and Wolves",'kramma'],
	slalom    :[1,1,"スラローム","Slalom (Suraromu)",'',{alias:'suraromu'}],
	slither   :[0,1,"スリザーリンク","Slitherlink",'',{kanpen:'slitherlink'}],
	starbattle:[0,0,"スターバトル","Star Battle"],
	stostone  :[0,0,"ストストーン","Stostone",'shimaguni'],
	sudoku    :[0,1,"数独","Sudoku"],
	sukoro    :[1,0,"数コロ","Sukoro",'sukoro'],
	sukororoom:[0,0,"数コロ部屋","Sukoro-room",'sukoro'],
	tapa      :[0,0,"Tapa","Tapa"],
	tasquare  :[0,0,"たすくえあ","Tasquare"],
	tatamibari:[1,0,"タタミバリ","Tatamibari"],
	tateyoko  :[1,0,"タテボーヨコボー","Tatebo-Yokobo"],
	tawa      :[0,0,"たわむれんが","Tawamurenga"],
	tentaisho :[0,1,"天体ショー","Tentaisho"],
	tilepaint :[1,0,"タイルペイント","Tilepaint"],
	toichika  :[0,0,"遠い誓い","Toichika"],
	triplace  :[0,0,"トリプレイス","Tri-place"],
	usotatami :[0,0,"ウソタタミ","Uso-tatami",'fillmat'],
	usoone    :[0,0,"ウソワン","Uso-one"],
	view      :[1,0,"ヴィウ","View",'sukoro'],
	wagiri    :[0,0,"ごきげんななめ・輪切","Gokigen-naname:wagiri",'gokigen'],
	wblink    :[0,0,"シロクロリンク","Shirokuro-link"],
	yajikazu  :[1,0,"やじさんかずさん","Yajisan-Kazusan"],
	yajirin   :[0,1,"ヤジリン","Yajilin",'',{pzprurl:'yajilin',kanpen:'yajilin'}],
	yajitatami:[0,0,"ヤジタタミ","Yajitatami"],
	yinyang   :[0,0,"しろまるくろまる","Yin-Yang"],
	yosenabe  :[0,0,"よせなべ","Yosenabe"]
});

})();
<|endoftext|>


<commit_before>/**
 * qUnitScraper object
 */
var qUnitScraper = {
    /**
     * Start here!
     * This is the first method to invoke to call other method.
     * Currently it can only does the call to other methods and doesn't do any processing here.
     * It then should return all the failed modules in object format back to caller.
     *
     * @params : none
     * @return : (object) the object listing all the failed modules along with their information
     */
    init: function() {
        // validate page here

        var failedMessages = this._readResults();
        return( failedMessages );
    },
    /**
     * _readResults create a jQuery object, selecting output listing.
     * Currently it's looking only for the failed modules, but could be
     * extended to specify which to look for.
     * It calls other methods to get the information it needs and returns an object
     * listing each method indexed by the method number as displayed to user.
     *
     * @params : none
     * @return : (object) listing all the failed modules along with their information.
     */
    _readResults: function( ) {
        var failedModules = jQuery("#qunit-tests .fail[id^=qunit-test-output]");
        var failedMessages = [];

        var numFailedModules = failedModules.length;
        for( var moduleNumber=0; moduleNumber < numFailedModules; moduleNumber++ )
        {
            var thisModule = failedModules[moduleNumber];
            failedMessages["module " + this._getModuleNumber(jQuery(thisModule))] = this._readModule( thisModule );
        }

        return failedMessages;
    },
    /**
     * This method takes jQuery object of the modules we want to read.
     * It then searches for the assert list result, currently the failed ones.
     * Like _readResults, it could be extended.
     * The method puts together the list found, builds an object including the name, message and source
     * and returns it.
     *
     * @params : (object) jQuery object of the module we want to read
     * @return : (object) an object with 2 properties, name of test and another object listing the tests
     */
    _readModule: function( failedModule ) {
        var failedTests   = jQuery(".qunit-assert-list .fail", failedModule);
        var failedMessages = {
            "name" : jQuery(".module-name", failedModule).html() + ": " + jQuery(".test-name", failedModule).html(),
            "tests": []
        };

        var numFailedTests = failedTests.length;
        for( var testNumber=0; testNumber < numFailedTests; testNumber++ ) {
            var thisTest = failedTests[testNumber];
            failedMessages["tests"].push({
                "message": jQuery(".test-message", thisTest).html(),
                "source" : jQuery(".test-source pre", thisTest).html()
            });
        }

        return failedMessages;
    },
    /**
     * This one takes a jQuery object of the module we want to find the number.
     * Performs a regex match over the id of the DOM which includes an index at the very end.
     * Lastly, we add 1 to the number since the ID is 0-indexed vs the list display to user is 1-indexed.
     *
     * @params : (object) jQuery object of the module element
     * @return : (int) module number as display to users
     */
    _getModuleNumber: function( module ) {
        var id = module.attr( "id" );
        var match = id.match( /\d+$/ )[0];
        return parseInt( match ) + 1 ;
    }
}<commit_msg>Rename variables<commit_after>/**
 * qUnitScraper object
 */
var qUnitScraper = {
    /**
     * Start here!
     * This is the first method to invoke to call other method.
     * Currently it can only does the call to other methods and doesn't do any processing here.
     * It then should return all the failed modules in object format back to caller.
     *
     * @params : none
     * @return : (object) the object listing all the failed modules along with their information
     */
    init: function() {
        // validate page here

        var results = this._readResults();
        return( results );
    },
    /**
     * _readResults create a jQuery object, selecting output listing.
     * Currently it's looking only for the failed modules, but could be
     * extended to specify which to look for.
     * It calls other methods to get the information it needs and returns an object
     * listing each method indexed by the method number as displayed to user.
     *
     * @params : none
     * @return : (object) listing all the failed modules along with their information.
     */
    _readResults: function( ) {
        var modules = jQuery("#qunit-tests .fail[id^=qunit-test-output]");
        var moduleResults = [];

        var numModules = modules.length;
        for( var moduleNumber=0; moduleNumber < numModules; moduleNumber++ )
        {
            var thisModule = modules[moduleNumber];
            moduleResults["module " + this._getModuleNumber(jQuery(thisModule))] = this._readModule( thisModule );
        }

        return moduleResults;
    },
    /**
     * This method takes jQuery object of the modules we want to read.
     * It then searches for the assert list result, currently the failed ones.
     * Like _readResults, it could be extended.
     * The method puts together the list found, builds an object including the name, message and source
     * and returns it.
     *
     * @params : (object) jQuery object of the module we want to read
     * @return : (object) an object with 2 properties, name of test and another object listing the tests
     */
    _readModule: function( module ) {
        var tests   = jQuery(".qunit-assert-list .fail", module);
        var testResults = {
            "name" : jQuery(".module-name", module).html() + ": " + jQuery(".test-name", module).html(),
            "tests": []
        };

        var numTests = tests.length;
        for( var testNumber=0; testNumber < numTests; testNumber++ ) {
            var thisTest = tests[testNumber];
            testResults["tests"].push({
                "message": jQuery(".test-message", thisTest).html(),
                "source" : jQuery(".test-source pre", thisTest).html()
            });
        }

        return testResults;
    },
    /**
     * This one takes a jQuery object of the module we want to find the number.
     * Performs a regex match over the id of the DOM which includes an index at the very end.
     * Lastly, we add 1 to the number since the ID is 0-indexed vs the list display to user is 1-indexed.
     *
     * @params : (object) jQuery object of the module element
     * @return : (int) module number as display to users
     */
    _getModuleNumber: function( module ) {
        var id = module.attr( "id" );
        var match = id.match( /\d+$/ )[0];
        return parseInt( match ) + 1 ;
    }
}<|endoftext|>


<commit_before>var parser = require('./sbp_parser');
var fs = require('fs');

function SBPRuntime() {
	this.program = []
	this.pc = 0
	this.user_vars = {}
	this.label_index = {}
	this.stack = []
};

SBPRuntime.prototype.runFile = function(filename) {
	fs.readFile(filename, 'utf8', function (err,data) {
		  if (err) {
		  	console.log('Error reading file ' + filename);
		    return console.log(err);
		  } else {
		  	this.runString(data);
		  }
		}.bind(this));
}

SBPRuntime.prototype.runFileSync = function(filename) {
	data = fs.readFileSync(filename, 'utf8');
	this.runString(data);
}
SBPRuntime.prototype.runString = function(s) {
	this.init();
    this.program = parser.parse(s + '\n');
    this._analyzeLabels();  // Build a table of labels
    this._analyzeGOTOs();   // Check all the GOTO/GOSUBs against the label table
    console.log(this.program);
    while(this.tick());
}

SBPRuntime.prototype.tick = function() {
	if(this.pc >= this.program.length) {
		return false;
	}
	line = this.program[this.pc];
	this._execute(line);
	return true;
}

SBPRuntime.prototype._execute = function(command) {
	if(!command) {
		this.pc += 1;
		return
	}
	switch(command.type) {
		case "cmd":
			if((command.cmd in this) && (typeof this[command.cmd] == 'function')) {
				this[command.cmd](command.args);
			} else {
				this._unhandledCommand(command)
			}
			this.pc += 1;
			break;

		case "return":
			console.log("RETURN");
			console.log(this.stack);
			if(this.stack) {
				this.pc = this.stack.pop();
			} else {
				throw "Runtime Error: Return with no GOSUB at " + this.pc;
			}
			break;

		case "end":
			this.pc = this.program.length;
			break;

		case "goto":
			if(command.label in this.label_index) {
				this.pc = this.label_index[command.label];
			} else {
				throw "Runtime Error: Unknown Label '" + command.label + "' at line " + this.pc;
			}
			break;

		case "gosub":
			if(command.label in this.label_index) {
				this.pc = this.label_index[command.label];
				this.stack.push([this.pc + 1])
			} else {
				throw "Runtime Error: Unknown Label '" + command.label + "' at line " + this.pc;
			}
			break;

		case "assign":
			this.user_vars[command.var] = this._eval(command.expr);
			this.pc += 1;
			break;

		case "cond":
			if(this._eval(command.cmp)) {
				this._execute(command.stmt);
			} else {
				this.pc += 1;
			}
			break;

		case "label":
		case undefined:
			this.pc += 1;
			break;

		default:
			console.log("GOT UNKNOWN COMMAND TYPE " + command.type)
			this.pc += 1;
			break;
	}
}

SBPRuntime.prototype._eval = function(expr) {
	if(expr.op == undefined) {
		if (expr in this.user_vars) {
			return this.user_vars[expr];
		} else {
			return expr;
		}
	} else {
		switch(expr.op) {
			case '+':
				return this._eval(expr.left) + this._eval(expr.right);
				break;
			case '-':
				return this._eval(expr.left) - this._eval(expr.right);
				break;
			case '*':
				return this._eval(expr.left) * this._eval(expr.right);
				break;
			case '/':
				return this._eval(expr.left) / this._eval(expr.right);
				break;
			case '>':
				return this._eval(expr.left) > this._eval(expr.right);
				break;
			case '<':
				return this._eval(expr.left) < this._eval(expr.right);
				break;
			case '>=':
				return this._eval(expr.left) >= this._eval(expr.right);
				break;
			case '<=':
				return this._eval(expr.left) <= this._eval(expr.right);
				break;
			case '==':
				return this._eval(expr.left) == this._eval(expr.right);
				break;
			case '!=':
				return this._eval(expr.left) != this._eval(expr.right);
				break;

			default:
				throw "Unhandled operation: " + expr.op;
		}
	}
}

SBPRuntime.prototype.init = function() {
	this.pc = 0;
	this.stack = []
	this.label_index = {}
}

// Compile an index of all the labels in the program
SBPRuntime.prototype._analyzeLabels = function() {
	this.label_index = {}
	for(i=0; i<this.program.length; i++) {
		line = this.program[i];
		if(line) {
			switch(line.type) {
				case "label":
					if (line.value in this.label_index) {
						throw "Duplicate label."
					}
					this.label_index[line.value] = i;
					break;
			}
		}
	}
}

// Check all the GOTOS/GOSUBS in the program and make sure their labels exist
SBPRuntime.prototype._analyzeGOTOs = function() {
	for(i=0; i<this.program.length; i++) {
			line = this.program[i];
			if(line) {
				switch(line.type) {
					case "cond":
						line = line.stmt;
						// No break: fall through to next state
					case "goto":
					case "gosub":
						if (line.label in this.label_index) {

						} else {
							throw "Unknown label " + line.label + " on line " + i;
						}
						break;
				}
			}
		}
}

SBPRuntime.prototype._unhandledCommand = function(command) {
	console.log('Unhandled Command: ' + JSON.stringify(command));
}

SBPRuntime.prototype.MX = function(args) {
	console.log("G1 X" + args[0]);
}

SBPRuntime.prototype.MY = function(args) {
	console.log("G1 Y" + args[0]);
}

SBPRuntime.prototype.MZ = function(args) {
	console.log("G1 Z" + args[0]);
}

runtime = new SBPRuntime();
runtime.runFileSync('example.sbp');
console.log(runtime.user_vars);

<commit_msg>Added SB Moves and Jog<commit_after>var parser = require('./sbp_parser');
var fs = require('fs');

function SBPRuntime() {
	this.program = []
	this.pc = 0
	this.user_vars = {}
	this.label_index = {}
	this.stack = []
};

SBPRuntime.prototype.runFile = function(filename) {
	fs.readFile(filename, 'utf8', function (err,data) {
		  if (err) {
		  	console.log('Error reading file ' + filename);
		    return console.log(err);
		  } else {
		  	this.runString(data);
		  }
		}.bind(this));
}

SBPRuntime.prototype.runFileSync = function(filename) {
	data = fs.readFileSync(filename, 'utf8');
	this.runString(data);
}
SBPRuntime.prototype.runString = function(s) {
	this.init();
    this.program = parser.parse(s + '\n');
    this._analyzeLabels();  // Build a table of labels
    this._analyzeGOTOs();   // Check all the GOTO/GOSUBs against the label table
    console.log(this.program);
    while(this.tick());
}

SBPRuntime.prototype.tick = function() {
	if(this.pc >= this.program.length) {
		return false;
	}
	line = this.program[this.pc];
	this._execute(line);
	return true;
}

SBPRuntime.prototype._execute = function(command) {
	if(!command) {
		this.pc += 1;
		return
	}
	switch(command.type) {
		case "cmd":
			if((command.cmd in this) && (typeof this[command.cmd] == 'function')) {
				this[command.cmd](command.args);
			} else {
				this._unhandledCommand(command)
			}
			this.pc += 1;
			break;

		case "return":
			console.log("RETURN");
			console.log(this.stack);
			if(this.stack) {
				this.pc = this.stack.pop();
			} else {
				throw "Runtime Error: Return with no GOSUB at " + this.pc;
			}
			break;

		case "end":
			this.pc = this.program.length;
			break;

		case "goto":
			if(command.label in this.label_index) {
				this.pc = this.label_index[command.label];
			} else {
				throw "Runtime Error: Unknown Label '" + command.label + "' at line " + this.pc;
			}
			break;

		case "gosub":
			if(command.label in this.label_index) {
				this.pc = this.label_index[command.label];
				this.stack.push([this.pc + 1])
			} else {
				throw "Runtime Error: Unknown Label '" + command.label + "' at line " + this.pc;
			}
			break;

		case "assign":
			this.user_vars[command.var] = this._eval(command.expr);
			this.pc += 1;
			break;

		case "cond":
			if(this._eval(command.cmp)) {
				this._execute(command.stmt);
			} else {
				this.pc += 1;
			}
			break;

		case "label":
		case undefined:
			this.pc += 1;
			break;

		default:
			console.log("GOT UNKNOWN COMMAND TYPE " + command.type)
			this.pc += 1;
			break;
	}
}

SBPRuntime.prototype._eval = function(expr) {
	if(expr.op == undefined) {
		if (expr in this.user_vars) {
			return this.user_vars[expr];
		} else {
			return expr;
		}
	} else {
		switch(expr.op) {
			case '+':
				return this._eval(expr.left) + this._eval(expr.right);
				break;
			case '-':
				return this._eval(expr.left) - this._eval(expr.right);
				break;
			case '*':
				return this._eval(expr.left) * this._eval(expr.right);
				break;
			case '/':
				return this._eval(expr.left) / this._eval(expr.right);
				break;
			case '>':
				return this._eval(expr.left) > this._eval(expr.right);
				break;
			case '<':
				return this._eval(expr.left) < this._eval(expr.right);
				break;
			case '>=':
				return this._eval(expr.left) >= this._eval(expr.right);
				break;
			case '<=':
				return this._eval(expr.left) <= this._eval(expr.right);
				break;
			case '==':
				return this._eval(expr.left) == this._eval(expr.right);
				break;
			case '!=':
				return this._eval(expr.left) != this._eval(expr.right);
				break;

			default:
				throw "Unhandled operation: " + expr.op;
		}
	}
}

SBPRuntime.prototype.init = function() {
	this.pc = 0;
	this.stack = []
	this.label_index = {}
}

// Compile an index of all the labels in the program
SBPRuntime.prototype._analyzeLabels = function() {
	this.label_index = {}
	for(i=0; i<this.program.length; i++) {
		line = this.program[i];
		if(line) {
			switch(line.type) {
				case "label":
					if (line.value in this.label_index) {
						throw "Duplicate label."
					}
					this.label_index[line.value] = i;
					break;
			}
		}
	}
}

// Check all the GOTOS/GOSUBS in the program and make sure their labels exist
SBPRuntime.prototype._analyzeGOTOs = function() {
	for(i=0; i<this.program.length; i++) {
			line = this.program[i];
			if(line) {
				switch(line.type) {
					case "cond":
						line = line.stmt;
						// No break: fall through to next state
					case "goto":
					case "gosub":
						if (line.label in this.label_index) {

						} else {
							throw "Unknown label " + line.label + " on line " + i;
						}
						break;
				}
			}
		}
}

SBPRuntime.prototype._unhandledCommand = function(command) {
	console.log('Unhandled Command: ' + JSON.stringify(command));
}

SBPRuntime.prototype.emit_gcode = function(s) {
	console.log(s);
}

SBPRuntime.prototype.MX = function(args) {
	this.emit_gcode("G1 X" + args[0]);
}

SBPRuntime.prototype.MY = function(args) {
	this.emit_gcode("G1 Y" + args[0]);
}

SBPRuntime.prototype.MZ = function(args) {
	this.emit_gcode("G1 Z" + args[0]);
}

SBPRuntime.prototype.MA = function(args) {
	this.emit_gcode("G1 A" + args[0]);
}

SBPRuntime.prototype.MB = function(args) {
	this.emit_gcode("G1 B" + args[0]);
}

SBPRuntime.prototype.MC = function(args) {
	this.emit_gcode("G1 C" + args[0]);
}

SBPRuntime.prototype.M2 = function(args) {
	this.emit_gcode("G1 X" + args[0] + " Y" + args[1]);
}

SBPRuntime.prototype.M3 = function(args) {
	this.emit_gcode("G1 X" + args[0] + "Y" + args[1] + "Z" + args[2]);
}

SBPRuntime.prototype.M4 = function(args) {
	this.emit_gcode("G1 X" + args[0] + "Y" + args[1] + "Z" + args[2] + "A" + args[3]);
}

SBPRuntime.prototype.M5 = function(args) {
	this.emit_gcode("G1 X" + args[0] + "Y" + args[1] + "Z" + args[2] + "A" + args[3] + "B" + args[4]);
}

SBPRuntime.prototype.M6 = function(args) {
	this.emit_gcode("G1 X" + args[0] + "Y" + args[1] + "Z" + args[2] + "A" + args[3] + "B" + args[4] + "C" " args[5]");
}

SBPRuntime.prototype.JX = function(args) {
	this.emit_gcode("G0 X" + args[0]);
}

SBPRuntime.prototype.JY = function(args) {
	this.emit_gcode("G0 Y" + args[0]);
}

SBPRuntime.prototype.JZ = function(args) {
	this.emit_gcode("G0 Z" + args[0]);
}

SBPRuntime.prototype.JA = function(args) {
	this.emit_gcode("G0 A" + args[0]);
}

SBPRuntime.prototype.JB = function(args) {
	this.emit_gcode("G0 B" + args[0]);
}

SBPRuntime.prototype.JC = function(args) {
	this.emit_gcode("G0 C" + args[0]);
}

SBPRuntime.prototype.J2 = function(args) {
	this.emit_gcode("G0 X" + args[0] + " Y" + args[1]);
}

SBPRuntime.prototype.J3 = function(args) {
	this.emit_gcode("G0 X" + args[0] + "Y" + args[1] + "Z" + args[2]);
}

SBPRuntime.prototype.J4 = function(args) {
	this.emit_gcode("G0 X" + args[0] + "Y" + args[1] + "Z" + args[2] + "A" + args[3]);
}

SBPRuntime.prototype.J5 = function(args) {
	this.emit_gcode("G0 X" + args[0] + "Y" + args[1] + "Z" + args[2] + "A" + args[3] + "B" + args[4]);
}

SBPRuntime.prototype.J6 = function(args) {
	this.emit_gcode("G0 X" + args[0] + "Y" + args[1] + "Z" + args[2] + "A" + args[3] + "B" + args[4] + "C" " args[5]");
}

runtime = new SBPRuntime();
runtime.runFileSync('example.sbp');
console.log(runtime.user_vars);

<|endoftext|>


<commit_before>/**
 * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * WSO2 Inc. licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
define(['require', 'log', 'jquery', 'lodash', 'console','workspace','toolEditor', 'perfect_scrollbar'],
    function (require, log, jquery, _, Console, Workspace,ToolEditor, PerfectScrollbar) {
        var  ServiceConsole;

        ServiceConsole = Console.extend({
            initialize: function (options) {
                Console.prototype.initialize.call(this, options);
                this.consolePerfectScroller = new PerfectScrollbar('.output-console-content.perfect-scroller');
                this.app = options.application;
            },
            getFile: function(){
                return this._file;
            },

            getTitle: function(){
                return this._title;
            },

            getContentContainer: function(){
                return this.$el;
            },

            updateHeader: function(){
            },

            showInitialStartingMessage: function(message){
                this.$el.append('' + message + '');
                this.$el.append("
");
                this.$el.scrollTop(100000);
            },

            println: function(message){
                this.$el.append('' + message.message + '');
                this.$el.append("
");
                this.$el.scrollTop(100000);
                this.consolePerfectScroller.update();
                var parentDiv = this.$el.parent()[0];
                parentDiv.scrollTop = parentDiv.scrollHeight;
                var childLength = this.$el.children().size();
                //console.log("Count="+);
                if(childLength > 2500){
                    $(this.$el).children().first().remove();
                }
            },

            addRunningPlan: function(executionPlan){
                this.addRunningPlanToList(executionPlan);
            },

            clear: function(){
                this.$el.empty();
            }

        });

        return ServiceConsole;
    });
<commit_msg>Prevent re-initializing perfect scroller for the same division<commit_after>/**
 * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * WSO2 Inc. licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
define(['require', 'log', 'jquery', 'lodash', 'console','workspace','toolEditor', 'perfect_scrollbar'],
    function (require, log, jquery, _, Console, Workspace,ToolEditor, PerfectScrollbar) {
        var  ServiceConsole;

        ServiceConsole = Console.extend({
            initialize: function (options) {
                Console.prototype.initialize.call(this, options);
                this.consolePerfectScroller = (function() {
                    if (!$('#' + options.cid + '.output-console-content').hasClass('ps')) {
                        return new PerfectScrollbar('#' + options.cid + '.output-console-content');
                    }
                })();
                this.app = options.application;
            },
            getFile: function(){
                return this._file;
            },

            getTitle: function(){
                return this._title;
            },

            getContentContainer: function(){
                return this.$el;
            },

            updateHeader: function(){
            },

            showInitialStartingMessage: function(message){
                this.$el.append('' + message + '');
                this.$el.append("
");
                this.$el.scrollTop(100000);
            },

            println: function(message){
                this.$el.append('' + message.message + '');
                this.$el.append("
");
                this.$el.scrollTop(100000);
                this.consolePerfectScroller.update();
                var parentDiv = this.$el.parent()[0];
                parentDiv.scrollTop = parentDiv.scrollHeight;
                var childLength = this.$el.children().size();
                //console.log("Count="+);
                if(childLength > 2500){
                    $(this.$el).children().first().remove();
                }
            },

            addRunningPlan: function(executionPlan){
                this.addRunningPlanToList(executionPlan);
            },

            clear: function(){
                this.$el.empty();
            }

        });

        return ServiceConsole;
    });
<|endoftext|>


<commit_before>// Saves options to chrome.storage.sync.
function save_options() {
    var selTemp = document.getElementById('selTemplate').value;
    var unselTemp = document.getElementById('unselTemplate').value;
    var useOldStyleLinks = document.getELementById('useOldstyle').checked;
    chrome.storage.sync.set({
        selectedTemplate: selTemp,
        unselectedTemplate: unselTemp,
        useOldstyleLinks: useOldStyleLinks
    }, function() {
        // Update status to let user know options were saved.
        var status = document.getElementById('status');
        status.textContent = 'Options saved.';
        setTimeout(function() {
            status.textContent = '';
        }, 750);
    });
}

// Restores select box and checkbox state using the preferences
// stored in chrome.storage.
function restore_options() {
    // Use default value color = 'red' and likesColor = true.
    chrome.storage.sync.get({
        selectedTemplate: 'nt',
        unselectedTemplate: 'b',
        useOldstyleLinks: false
    }, function(items) {
        document.getElementById('unselTemplate').value = items.unselectedTemplate;
        document.getElementById('selTemplate').value = items.selectedTemplate;
        document.getELementById('useOldstyle').checked = items.useOldstyleLinks;
    });
}
document.addEventListener('DOMContentLoaded', restore_options);
document.getElementById('save').addEventListener('click',
                                                 save_options);
<commit_msg>Fixed Typo<commit_after>// Saves options to chrome.storage.sync.
function save_options() {
    var selTemp = document.getElementById('selTemplate').value;
    var unselTemp = document.getElementById('unselTemplate').value;
    var useOldStyleLinks = document.getElementById('useOldstyle').checked;
    chrome.storage.sync.set({
        selectedTemplate: selTemp,
        unselectedTemplate: unselTemp,
        useOldstyleLinks: useOldStyleLinks
    }, function() {
        // Update status to let user know options were saved.
        var status = document.getElementById('status');
        status.textContent = 'Options saved.';
        setTimeout(function() {
            status.textContent = '';
        }, 750);
    });
}

// Restores select box and checkbox state using the preferences
// stored in chrome.storage.
function restore_options() {
    // Use default value color = 'red' and likesColor = true.
    chrome.storage.sync.get({
        selectedTemplate: 'nt',
        unselectedTemplate: 'b',
        useOldstyleLinks: false
    }, function(items) {
        document.getElementById('unselTemplate').value = items.unselectedTemplate;
        document.getElementById('selTemplate').value = items.selectedTemplate;
        document.getElementById('useOldstyle').checked = items.useOldstyleLinks;
    });
}
document.addEventListener('DOMContentLoaded', restore_options);
document.getElementById('save').addEventListener('click',
                                                 save_options);
<|endoftext|>


<commit_before>/*global loadRules,saveRules,loadCloseSetting,saveCloseSetting*/
angular.module('options', [])
    .controller('options', options)
    .directive('addAttr', addAttr);

function options($scope, $timeout) {
    $scope.matchCopy = {
        exact: 'exactly',
        base: 'up to the ?',
        hash: 'up to the #'
    };

    function reloadRules() {
        if($scope.rule) {
            postSaved();
        }
        $scope.rule = {match: 'hash'};
        loadRules((rules) => {
            $scope.rules = rules;
            $scope.$apply();
        });
    }

    function postSaved() {
        $scope.settingsSaved = true;
        $timeout(() => {
            $scope.settingsSaved = false;
        }, 3000);
        $scope.$apply();
    }

    $scope.saveRule = () => {
        if($scope.rule.url) {
            delete $scope.editingRule;
            $scope.ruleSaved = false;
            $scope.rules[$scope.rule.url] = $scope.rule.match;
            saveRules($scope.rules, reloadRules);
        }
    };

    $scope.deleteRule = (url) => {
        delete $scope.rules[url];
        saveRules($scope.rules, reloadRules);
    };

    $scope.editRule = (url, match) => {
        $scope.editingRule = url;
        $scope.rule = {
            url: url,
            match: match
        };
    };

    $scope.editing = (url) => url === $scope.editingRule;

    loadCloseSetting((close) => {
        $scope.close = close;
        $scope.$apply();
        watchClose();
    });

    function watchClose() {
        var ignoreFirst = true;
        $scope.$watch('close', (close) => {
            if(ignoreFirst) {
                ignoreFirst = false;
            } else {
                saveCloseSetting(close, postSaved);
            }
        });
    }

    reloadRules();
}

function addAttr() {
    return {
        link: function($scope, $element, $attrs) {
        }
    };
}
<commit_msg>added dynamic attrs watching directive<commit_after>/*global loadRules,saveRules,loadCloseSetting,saveCloseSetting*/
angular.module('options', [])
    .controller('options', options)
    .directive('dynAttrs', dynAttrs);

function options($scope, $timeout) {
    $scope.matchCopy = {
        exact: 'exactly',
        base: 'up to the ?',
        hash: 'up to the #'
    };

    function reloadRules() {
        if($scope.rule) {
            postSaved();
        }
        $scope.rule = {match: 'hash'};
        loadRules((rules) => {
            $scope.rules = rules;
            $scope.$apply();
        });
    }

    function postSaved() {
        $scope.settingsSaved = true;
        $timeout(() => {
            $scope.settingsSaved = false;
        }, 3000);
        $scope.$apply();
    }

    $scope.saveRule = () => {
        if($scope.rule.url) {
            delete $scope.editingRule;
            $scope.ruleSaved = false;
            $scope.rules[$scope.rule.url] = $scope.rule.match;
            saveRules($scope.rules, reloadRules);
        }
    };

    $scope.deleteRule = (url) => {
        delete $scope.rules[url];
        saveRules($scope.rules, reloadRules);
    };

    $scope.editRule = (url, match) => {
        $scope.editingRule = url;
        $scope.rule = {
            url: url,
            match: match
        };
    };

    $scope.editing = (url) => url === $scope.editingRule;

    loadCloseSetting((close) => {
        $scope.close = close;
        $scope.$apply();
        watchClose();
    });

    function watchClose() {
        var ignoreFirst = true;
        $scope.$watch('close', (close) => {
            if(ignoreFirst) {
                ignoreFirst = false;
            } else {
                saveCloseSetting(close, postSaved);
            }
        });
    }

    reloadRules();
}

function dynAttrs() {
    return {
        link: function(scope, element, attrs) {
            scope.$watch(attrs.dynAttrs, (dynAttrs) => {
                _.each(dynAttrs, (val, attr) => {
                    if(val) {
                        element.attr(attr, val);
                    } else {
                        element.removeAttr(attr);
                    }
                });
            });
        }
    };
}
<|endoftext|>


<commit_before>var path = require('path')
var pkg = require('./package.json')

module.exports = {
  // cmd, homepage, bugs all pulled from package.json
  cmd: 'happiness',
  version: pkg.version,
  homepage: pkg.homepage,
  bugs: pkg.bugs.url,
  tagline: 'Happiness',
  eslintConfig: {
      configFile: path.join(__dirname, 'eslintrc.json')
  }
}
<commit_msg>Fixing indentation<commit_after>var path = require('path')
var pkg = require('./package.json')

module.exports = {
  // cmd, homepage, bugs all pulled from package.json
  cmd: 'happiness',
  version: pkg.version,
  homepage: pkg.homepage,
  bugs: pkg.bugs.url,
  tagline: 'Happiness',
  eslintConfig: {
    configFile: path.join(__dirname, 'eslintrc.json')
  }
}
<|endoftext|>


<commit_before>const Signal = require('signals')
const mat4 = require('pex-math/mat4')
const vec3 = require('pex-math/vec3')
const quat = require('pex-math/quat')
const ray = require('pex-geom/ray')
const interpolateAngle = require('interpolate-angle')
const clamp = require('pex-math/utils').clamp
const lerp = require('pex-math/utils').lerp
const toRadians = require('pex-math/utils').toRadians
const toDegrees = require('pex-math/utils').toDegrees
const latLonToXyz = require('latlon-to-xyz')
const xyzToLatLon = require('xyz-to-latlon')
const eventOffset = require('mouse-event-offset')

function offset (e, target) {
  if (e.touches) return eventOffset(e.touches[0], target)
  else return eventOffset(e, target)
}

function getViewRay (camera, x, y, windowWidth, windowHeight) {
  if (camera.frustum) {
    x += camera.frustum.offset[0]
    y += camera.frustum.offset[1]
    windowWidth = camera.frustum.totalSize[0]
    windowHeight = camera.frustum.totalSize[1]
  }
  let nx = 2 * x / windowWidth - 1
  let ny = 1 - 2 * y / windowHeight

  let hNear = 2 * Math.tan(camera.fov / 2) * camera.near
  let wNear = hNear * camera.aspect

  nx *= (wNear * 0.5)
  ny *= (hNear * 0.5)

  let origin = [0, 0, 0]
  let direction = vec3.normalize([nx, ny, -camera.near])
  let ray = [origin, direction]

  return ray
}

function Orbiter (opts) {
  this.type = 'Orbiter'
  this.entity = null
  this.dirty = false
  this.changed = new Signal()

  const initialState = {
    target: [0, 0, 0],
    position: [0, 0, 5],
    matrix: mat4.create(),
    invViewMatrix: mat4.create(),
    dragging: false,
    lat: 0, // Y
    lon: 0, // XZ
    currentLat: 0,
    currentLon: 0,
    easing: 0.1,
    element: opts.element || document,
    width: 0,
    height: 0,
    clickPosWindow: [0, 0],
    dragPos: [0, 0, 0],
    dragPosWindow: [0, 0],
    distance: 1,
    currentDistance: 1,
    minDistance: 0.1,
    maxDistance: 10,
    minLat: -89.5,
    maxLat: 89.5,
    minLon: -Infinity,
    maxLon: Infinity,
    zoomSlowdown: 400,
    zoom: true,
    pan: true,
    drag: true,
    dragSlowdown: 4,
    clickTarget: [0, 0, 0],
    clickPosPlane: [0, 0, 0],
    dragPosPlane: [0, 0, 0],
    clickPosWorld: [0, 0, 0],
    dragPosWorld: [0, 0, 0],
    panPlane: null,
    autoUpdate: true
  }

  this.set(initialState)
  this.set(opts)
}

Orbiter.prototype.init = function (entity) {
  this.entity = entity
  this.setup()
}

Orbiter.prototype.set = function (opts) {
  Object.assign(this, opts)
  if (opts.target || opts.position) {
    const distance = vec3.distance(this.position, this.target)
    const latLon = xyzToLatLon(vec3.normalize(vec3.sub(vec3.copy(this.position), this.target)))
    this.lat = latLon[0]
    this.lon = latLon[1]
    this.currentLat = this.lat
    this.currentLon = this.lon
    this.distance = distance
    this.currentDistance = this.distance
    this.minDistance = opts.minDistance || distance / 10
    this.maxDistance = opts.maxDistance || distance * 10
    this.minLat = opts.minLat || -89.5
    this.maxLat = opts.maxLat || 89.5
    this.minLon = opts.minLon || -Infinity
    this.maxLon = opts.maxLon || Infinity
  }
  Object.keys(opts).forEach((prop) => this.changed.dispatch(prop))
}

Orbiter.prototype.update = function () {
  const camera = this.entity.getComponent('Camera')
  this.updateMatrix()
  const transformCmp = this.entity.transform
  const transformRotation = transformCmp.rotation
  quat.fromMat4(transformRotation, this.matrix)

  if (camera) {
    transformCmp.set({
      position: this.position,
      rotation: transformRotation
    })
  } else {
    transformCmp.set({
      rotation: transformRotation
    })
  }
}

Orbiter.prototype.updateWindowSize = function () {
  const width = this.element.clientWidth || this.element.innerWidth
  const height = this.element.clientHeight || this.element.innerHeight
  if (width !== this.width) {
    this.width = width
    this.height = height
  }
}

Orbiter.prototype.updateMatrix = function () {
  const camera = this.entity.getComponent('Camera')
  const position = this.position
  const target = this.target

  this.lat = clamp(this.lat, this.minLat, this.maxLat)
  this.lon = clamp(this.lon, this.minLon, this.maxLon) % 360

  this.currentLat = toDegrees(
    interpolateAngle(
      (toRadians(this.currentLat) + 2 * Math.PI) % (2 * Math.PI),
      (toRadians(this.lat) + 2 * Math.PI) % (2 * Math.PI),
      this.easing
    )
  )
  this.currentLon = toDegrees(
    interpolateAngle(
      (toRadians(this.currentLon) + 2 * Math.PI) % (2 * Math.PI),
      (toRadians(this.lon) + 2 * Math.PI) % (2 * Math.PI),
      this.easing
    )
  )
  this.currentDistance = lerp(this.currentDistance, this.distance, this.easing)

  // set new camera position according to the current
  // rotation at distance relative to target
  latLonToXyz(this.currentLat, this.currentLon, position)
  vec3.scale(position, this.currentDistance)
  vec3.add(position, target)
  mat4.identity(this.matrix)

  var up = [0, 1, 0]
  mat4.lookAt(this.matrix, position, target, up)

  if (camera) {
    mat4.invert(this.matrix)
  }
}

Orbiter.prototype.setup = function () {
  const orbiter = this

  function down (x, y, shift) {
    const camera = orbiter.entity.getComponent('Camera')
    orbiter.dragging = true
    orbiter.dragPos[0] = x
    orbiter.dragPos[1] = y
    if (camera && shift && orbiter.pan) {
      orbiter.updateWindowSize()
      orbiter.clickPosWindow[0] = x
      orbiter.clickPosWindow[1] = y
      vec3.set(orbiter.clickTarget, orbiter.target)
      const targetInViewSpace = vec3.multMat4(vec3.copy(orbiter.clickTarget), camera.viewMatrix)
      orbiter.panPlane = [targetInViewSpace, [0, 0, 1]]
      ray.hitTestPlane(
        getViewRay(camera, orbiter.clickPosWindow[0], orbiter.clickPosWindow[1], orbiter.width, orbiter.height),
        orbiter.panPlane[0],
        orbiter.panPlane[1],
        orbiter.clickPosPlane
      )
      ray.hitTestPlane(
        getViewRay(camera, orbiter.dragPosWindow[0], orbiter.dragPosWindow[1], orbiter.width, orbiter.height),
        orbiter.panPlane[0],
        orbiter.panPlane[1],
        orbiter.dragPosPlane
      )
    } else {
      orbiter.panPlane = null
    }
  }

  function move (x, y, shift) {
    const camera = orbiter.entity.getComponent('Camera')
    if (!orbiter.dragging) {
      return
    }
    if (camera && shift && orbiter.panPlane) {
      orbiter.dragPosWindow[0] = x
      orbiter.dragPosWindow[1] = y
      ray.hitTestPlane(
        getViewRay(camera, orbiter.clickPosWindow[0], orbiter.clickPosWindow[1], orbiter.width, orbiter.height),
        orbiter.panPlane[0],
        orbiter.panPlane[1],
        orbiter.clickPosPlane
      )
      ray.hitTestPlane(
        getViewRay(camera, orbiter.dragPosWindow[0], orbiter.dragPosWindow[1], orbiter.width, orbiter.height),
        orbiter.panPlane[0],
        orbiter.panPlane[1],
        orbiter.dragPosPlane
      )
      mat4.set(orbiter.invViewMatrix, camera.viewMatrix)
      mat4.invert(orbiter.invViewMatrix)
      vec3.multMat4(vec3.set(orbiter.clickPosWorld, orbiter.clickPosPlane), orbiter.invViewMatrix)
      vec3.multMat4(vec3.set(orbiter.dragPosWorld, orbiter.dragPosPlane), orbiter.invViewMatrix)
      const diffWorld = vec3.sub(vec3.copy(orbiter.dragPosWorld), orbiter.clickPosWorld)
      const target = vec3.sub(vec3.copy(orbiter.clickTarget), diffWorld)
      orbiter.set({ target: target })
    } else if (orbiter.drag) {
      const dx = x - orbiter.dragPos[0]
      const dy = y - orbiter.dragPos[1]
      orbiter.dragPos[0] = x
      orbiter.dragPos[1] = y

      orbiter.lat += dy / orbiter.dragSlowdown
      orbiter.lon -= dx / orbiter.dragSlowdown
    }
  }

  function up () {
    orbiter.dragging = false
    orbiter.panPlane = null
  }

  function scroll (dy) {
    if (!orbiter.zoom) {
      return
    }
    orbiter.distance *= 1 + dy / orbiter.zoomSlowdown
    orbiter.distance = clamp(orbiter.distance, orbiter.minDistance, orbiter.maxDistance)
  }

  function onMouseDown (e) {
    const pos = offset(e, window)
    down(
      pos[0],
      pos[1],
      e.shiftKey || (e.touches && e.touches.length === 2)
    )
  }

  function onMouseMove (e) {
    const pos = offset(e, window)
    move(
      pos[0],
      pos[1],
      e.shiftKey || (e.touches && e.touches.length === 2)
    )
  }

  function onMouseUp (e) {
    up()
  }

  function onWheel (e) {
    scroll(e.deltaY)
    e.preventDefault()
  }

  function onTouchStart (e) {
    e.preventDefault()
    onMouseDown(e)
  }

  function onTouchMove (e) {
    e.preventDefault()
    onMouseMove(e)
  }

  this._onMouseDown = onMouseDown
  this._onTouchStart = onTouchStart
  this._onMouseMove = onMouseMove
  this._onTouchMove = onTouchMove
  this._onMouseUp = onMouseUp
  this._onWheel = onWheel

  this.element.addEventListener('mousedown', onMouseDown)
  this.element.addEventListener('wheel', onWheel)

  this.element.addEventListener('touchstart', onTouchStart)
  this.element.addEventListener('touchmove', onTouchMove, { passive: false })
  this.element.addEventListener('touchend', onMouseUp)

  document.addEventListener('mousemove', onMouseMove)
  document.addEventListener('mouseup', onMouseUp)
}

Orbiter.prototype.dispose = function () {
  this.element.removeEventListener('mousedown', this._onMouseDown)
  this.element.removeEventListener('wheel', this._onWheel)

  this.element.removeEventListener('touchstart', this._onTouchStart)
  this.element.removeEventListener('touchmove', this._onMouseMove)
  this.element.removeEventListener('touchend', this._onMouseUp)

  document.removeEventListener('mousemove', this._onMouseMove)
  document.removeEventListener('mouseup', this._onMouseUp)
}

module.exports = function createOrbiter (opts) {
  return new Orbiter(opts)
}
<commit_msg>Use position relative to orbiter element instead of window for offset computation<commit_after>const Signal = require('signals')
const mat4 = require('pex-math/mat4')
const vec3 = require('pex-math/vec3')
const quat = require('pex-math/quat')
const ray = require('pex-geom/ray')
const interpolateAngle = require('interpolate-angle')
const clamp = require('pex-math/utils').clamp
const lerp = require('pex-math/utils').lerp
const toRadians = require('pex-math/utils').toRadians
const toDegrees = require('pex-math/utils').toDegrees
const latLonToXyz = require('latlon-to-xyz')
const xyzToLatLon = require('xyz-to-latlon')
const eventOffset = require('mouse-event-offset')

function offset (e, target) {
  if (e.touches) return eventOffset(e.touches[0], target)
  else return eventOffset(e, target)
}

function getViewRay (camera, x, y, windowWidth, windowHeight) {
  if (camera.frustum) {
    x += camera.frustum.offset[0]
    y += camera.frustum.offset[1]
    windowWidth = camera.frustum.totalSize[0]
    windowHeight = camera.frustum.totalSize[1]
  }
  let nx = 2 * x / windowWidth - 1
  let ny = 1 - 2 * y / windowHeight

  let hNear = 2 * Math.tan(camera.fov / 2) * camera.near
  let wNear = hNear * camera.aspect

  nx *= (wNear * 0.5)
  ny *= (hNear * 0.5)

  let origin = [0, 0, 0]
  let direction = vec3.normalize([nx, ny, -camera.near])
  let ray = [origin, direction]

  return ray
}

function Orbiter (opts) {
  this.type = 'Orbiter'
  this.entity = null
  this.dirty = false
  this.changed = new Signal()

  const initialState = {
    target: [0, 0, 0],
    position: [0, 0, 5],
    matrix: mat4.create(),
    invViewMatrix: mat4.create(),
    dragging: false,
    lat: 0, // Y
    lon: 0, // XZ
    currentLat: 0,
    currentLon: 0,
    easing: 0.1,
    element: opts.element || document,
    width: 0,
    height: 0,
    clickPosWindow: [0, 0],
    dragPos: [0, 0, 0],
    dragPosWindow: [0, 0],
    distance: 1,
    currentDistance: 1,
    minDistance: 0.1,
    maxDistance: 10,
    minLat: -89.5,
    maxLat: 89.5,
    minLon: -Infinity,
    maxLon: Infinity,
    zoomSlowdown: 400,
    zoom: true,
    pan: true,
    drag: true,
    dragSlowdown: 4,
    clickTarget: [0, 0, 0],
    clickPosPlane: [0, 0, 0],
    dragPosPlane: [0, 0, 0],
    clickPosWorld: [0, 0, 0],
    dragPosWorld: [0, 0, 0],
    panPlane: null,
    autoUpdate: true
  }

  this.set(initialState)
  this.set(opts)
}

Orbiter.prototype.init = function (entity) {
  this.entity = entity
  this.setup()
}

Orbiter.prototype.set = function (opts) {
  Object.assign(this, opts)
  if (opts.target || opts.position) {
    const distance = vec3.distance(this.position, this.target)
    const latLon = xyzToLatLon(vec3.normalize(vec3.sub(vec3.copy(this.position), this.target)))
    this.lat = latLon[0]
    this.lon = latLon[1]
    this.currentLat = this.lat
    this.currentLon = this.lon
    this.distance = distance
    this.currentDistance = this.distance
    this.minDistance = opts.minDistance || distance / 10
    this.maxDistance = opts.maxDistance || distance * 10
    this.minLat = opts.minLat || -89.5
    this.maxLat = opts.maxLat || 89.5
    this.minLon = opts.minLon || -Infinity
    this.maxLon = opts.maxLon || Infinity
  }
  Object.keys(opts).forEach((prop) => this.changed.dispatch(prop))
}

Orbiter.prototype.update = function () {
  const camera = this.entity.getComponent('Camera')
  this.updateMatrix()
  const transformCmp = this.entity.transform
  const transformRotation = transformCmp.rotation
  quat.fromMat4(transformRotation, this.matrix)

  if (camera) {
    transformCmp.set({
      position: this.position,
      rotation: transformRotation
    })
  } else {
    transformCmp.set({
      rotation: transformRotation
    })
  }
}

Orbiter.prototype.updateWindowSize = function () {
  const width = this.element.clientWidth || this.element.innerWidth
  const height = this.element.clientHeight || this.element.innerHeight
  if (width !== this.width) {
    this.width = width
    this.height = height
  }
}

Orbiter.prototype.updateMatrix = function () {
  const camera = this.entity.getComponent('Camera')
  const position = this.position
  const target = this.target

  this.lat = clamp(this.lat, this.minLat, this.maxLat)
  this.lon = clamp(this.lon, this.minLon, this.maxLon) % 360

  this.currentLat = toDegrees(
    interpolateAngle(
      (toRadians(this.currentLat) + 2 * Math.PI) % (2 * Math.PI),
      (toRadians(this.lat) + 2 * Math.PI) % (2 * Math.PI),
      this.easing
    )
  )
  this.currentLon = toDegrees(
    interpolateAngle(
      (toRadians(this.currentLon) + 2 * Math.PI) % (2 * Math.PI),
      (toRadians(this.lon) + 2 * Math.PI) % (2 * Math.PI),
      this.easing
    )
  )
  this.currentDistance = lerp(this.currentDistance, this.distance, this.easing)

  // set new camera position according to the current
  // rotation at distance relative to target
  latLonToXyz(this.currentLat, this.currentLon, position)
  vec3.scale(position, this.currentDistance)
  vec3.add(position, target)
  mat4.identity(this.matrix)

  var up = [0, 1, 0]
  mat4.lookAt(this.matrix, position, target, up)

  if (camera) {
    mat4.invert(this.matrix)
  }
}

Orbiter.prototype.setup = function () {
  const orbiter = this

  function down (x, y, shift) {
    const camera = orbiter.entity.getComponent('Camera')
    orbiter.dragging = true
    orbiter.dragPos[0] = x
    orbiter.dragPos[1] = y
    if (camera && shift && orbiter.pan) {
      orbiter.updateWindowSize()
      orbiter.clickPosWindow[0] = x
      orbiter.clickPosWindow[1] = y
      vec3.set(orbiter.clickTarget, orbiter.target)
      const targetInViewSpace = vec3.multMat4(vec3.copy(orbiter.clickTarget), camera.viewMatrix)
      orbiter.panPlane = [targetInViewSpace, [0, 0, 1]]
      ray.hitTestPlane(
        getViewRay(camera, orbiter.clickPosWindow[0], orbiter.clickPosWindow[1], orbiter.width, orbiter.height),
        orbiter.panPlane[0],
        orbiter.panPlane[1],
        orbiter.clickPosPlane
      )
      ray.hitTestPlane(
        getViewRay(camera, orbiter.dragPosWindow[0], orbiter.dragPosWindow[1], orbiter.width, orbiter.height),
        orbiter.panPlane[0],
        orbiter.panPlane[1],
        orbiter.dragPosPlane
      )
    } else {
      orbiter.panPlane = null
    }
  }

  function move (x, y, shift) {
    const camera = orbiter.entity.getComponent('Camera')
    if (!orbiter.dragging) {
      return
    }
    if (camera && shift && orbiter.panPlane) {
      orbiter.dragPosWindow[0] = x
      orbiter.dragPosWindow[1] = y
      ray.hitTestPlane(
        getViewRay(camera, orbiter.clickPosWindow[0], orbiter.clickPosWindow[1], orbiter.width, orbiter.height),
        orbiter.panPlane[0],
        orbiter.panPlane[1],
        orbiter.clickPosPlane
      )
      ray.hitTestPlane(
        getViewRay(camera, orbiter.dragPosWindow[0], orbiter.dragPosWindow[1], orbiter.width, orbiter.height),
        orbiter.panPlane[0],
        orbiter.panPlane[1],
        orbiter.dragPosPlane
      )
      mat4.set(orbiter.invViewMatrix, camera.viewMatrix)
      mat4.invert(orbiter.invViewMatrix)
      vec3.multMat4(vec3.set(orbiter.clickPosWorld, orbiter.clickPosPlane), orbiter.invViewMatrix)
      vec3.multMat4(vec3.set(orbiter.dragPosWorld, orbiter.dragPosPlane), orbiter.invViewMatrix)
      const diffWorld = vec3.sub(vec3.copy(orbiter.dragPosWorld), orbiter.clickPosWorld)
      const target = vec3.sub(vec3.copy(orbiter.clickTarget), diffWorld)
      orbiter.set({ target: target })
    } else if (orbiter.drag) {
      const dx = x - orbiter.dragPos[0]
      const dy = y - orbiter.dragPos[1]
      orbiter.dragPos[0] = x
      orbiter.dragPos[1] = y

      orbiter.lat += dy / orbiter.dragSlowdown
      orbiter.lon -= dx / orbiter.dragSlowdown
    }
  }

  function up () {
    orbiter.dragging = false
    orbiter.panPlane = null
  }

  function scroll (dy) {
    if (!orbiter.zoom) {
      return
    }
    orbiter.distance *= 1 + dy / orbiter.zoomSlowdown
    orbiter.distance = clamp(orbiter.distance, orbiter.minDistance, orbiter.maxDistance)
  }

  function onMouseDown (e) {
    const pos = offset(e, orbiter.element)
    down(
      pos[0],
      pos[1],
      e.shiftKey || (e.touches && e.touches.length === 2)
    )
  }

  function onMouseMove (e) {
    const pos = offset(e, orbiter.element)
    move(
      pos[0],
      pos[1],
      e.shiftKey || (e.touches && e.touches.length === 2)
    )
  }

  function onMouseUp (e) {
    up()
  }

  function onWheel (e) {
    scroll(e.deltaY)
    e.preventDefault()
  }

  function onTouchStart (e) {
    e.preventDefault()
    onMouseDown(e)
  }

  function onTouchMove (e) {
    e.preventDefault()
    onMouseMove(e)
  }

  this._onMouseDown = onMouseDown
  this._onTouchStart = onTouchStart
  this._onMouseMove = onMouseMove
  this._onTouchMove = onTouchMove
  this._onMouseUp = onMouseUp
  this._onWheel = onWheel

  this.element.addEventListener('mousedown', onMouseDown)
  this.element.addEventListener('wheel', onWheel)

  this.element.addEventListener('touchstart', onTouchStart)
  this.element.addEventListener('touchmove', onTouchMove, { passive: false })
  this.element.addEventListener('touchend', onMouseUp)

  document.addEventListener('mousemove', onMouseMove)
  document.addEventListener('mouseup', onMouseUp)
}

Orbiter.prototype.dispose = function () {
  this.element.removeEventListener('mousedown', this._onMouseDown)
  this.element.removeEventListener('wheel', this._onWheel)

  this.element.removeEventListener('touchstart', this._onTouchStart)
  this.element.removeEventListener('touchmove', this._onMouseMove)
  this.element.removeEventListener('touchend', this._onMouseUp)

  document.removeEventListener('mousemove', this._onMouseMove)
  document.removeEventListener('mouseup', this._onMouseUp)
}

module.exports = function createOrbiter (opts) {
  return new Orbiter(opts)
}
<|endoftext|>


<commit_before>
(function() {
'use strict';

ElmRuntime.Display = { FULLSCREEN: 0, COMPONENT: 1, NONE: 2 };

ElmRuntime.counter = 0;
ElmRuntime.guid = function() { return ElmRuntime.counter++; }

ElmRuntime.use = function(M) {
    if (typeof M === 'function') M = M();
    return M;
};

function isAlive(input) {
    if (!('defaultNumberOfKids' in input)) return true;
    var len = input.kids.length;
    if (len === 0) return false;
    if (len > input.defaultNumberOfKids) return true;
    var alive = false;
    for (var i = len; i--; ) {
        alive = alive || isAlive(input.kids[i]);
    }
    return alive;
}

ElmRuntime.filterDeadInputs = function(inputs) {
    var temp = [];
    for (var i = inputs.length; i--; ) {
        if (isAlive(inputs[i])) temp.push(inputs[i]);
    }
    return temp;
};

// define the draw function
var vendors = ['ms', 'moz', 'webkit', 'o'];
for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {
    window.requestAnimationFrame = window[vendors[i]+'RequestAnimationFrame'];
    window.cancelAnimationFrame  = window[vendors[i]+'CancelAnimationFrame'] ||
                                   window[vendors[i]+'CancelRequestAnimationFrame'];
}

if (window.requestAnimationFrame && window.cancelAnimationFrame) {
    var previous = 0;
    ElmRuntime.draw = function(callback) {
        window.cancelAnimationFrame(previous);
        previous = window.requestAnimationFrame(callback);
    };
} else {
    ElmRuntime.draw = function(callback) { callback(); };
}

}());
<commit_msg>Provide a fake window in needed, making runtime run on node.js<commit_after>
(function() {
'use strict';

ElmRuntime.Display = { FULLSCREEN: 0, COMPONENT: 1, NONE: 2 };

ElmRuntime.counter = 0;
ElmRuntime.guid = function() { return ElmRuntime.counter++; }

ElmRuntime.use = function(M) {
    if (typeof M === 'function') M = M();
    return M;
};

function isAlive(input) {
    if (!('defaultNumberOfKids' in input)) return true;
    var len = input.kids.length;
    if (len === 0) return false;
    if (len > input.defaultNumberOfKids) return true;
    var alive = false;
    for (var i = len; i--; ) {
        alive = alive || isAlive(input.kids[i]);
    }
    return alive;
}

ElmRuntime.filterDeadInputs = function(inputs) {
    var temp = [];
    for (var i = inputs.length; i--; ) {
        if (isAlive(inputs[i])) temp.push(inputs[i]);
    }
    return temp;
};

// define the draw function
var vendors = ['ms', 'moz', 'webkit', 'o'];
var window = window || {};
for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {
    window.requestAnimationFrame = window[vendors[i]+'RequestAnimationFrame'];
    window.cancelAnimationFrame  = window[vendors[i]+'CancelAnimationFrame'] ||
                                   window[vendors[i]+'CancelRequestAnimationFrame'];
}

if (window.requestAnimationFrame && window.cancelAnimationFrame) {
    var previous = 0;
    ElmRuntime.draw = function(callback) {
        window.cancelAnimationFrame(previous);
        previous = window.requestAnimationFrame(callback);
    };
} else {
    ElmRuntime.draw = function(callback) { callback(); };
}

}());
<|endoftext|>


<commit_before>Package.describe({
	summary: "A roles based account management system - restyled for semantic-ui",
  version: "0.3.0",
  git: "git@github.com:cfly15/meteor-manage-users.git"
});

Package.on_use(function (api, where) {
  api.versionsFrom("METEOR@0.9.0");
	api.use('standard-app-packages', ['client', 'server']);
	api.use("alanning:roles@1.2.13", ['client', 'server']);

	api.add_files('libs/user_query.js', ['client', 'server']);

	api.add_files('client/startup.js', 'client');
	api.add_files('client/accounts_admin.html', 'client');
	api.add_files('client/accounts_admin.js', 'client');
	api.add_files('client/delete_account_modal.html', 'client');
	api.add_files('client/delete_account_modal.js', 'client');
	api.add_files('client/info_account_modal.html', 'client');
	api.add_files('client/info_account_modal.js', 'client');
	api.add_files('client/update_account_modal.html', 'client');
	api.add_files('client/update_account_modal.js', 'client');
	api.add_files('client/update_roles_modal.html', 'client');
	api.add_files('client/update_roles_modal.js', 'client');
	api.add_files('client/add_user_modal.html', 'client');
	api.add_files('client/add_user_modal.js', 'client');
	api.add_files('client/accounts_routes.js', 'client');

	api.add_files('style/style.css', 'client');

	api.add_files('server/startup.js', 'server');
	api.add_files('server/publish.js', 'server');
	api.add_files('server/methods.js', 'server');

	api.export('ManageUsers', ['server', 'client']);
});
<commit_msg>update<commit_after>Package.describe({
	name: "manage-users",
	summary: "A roles based account management system",
  version: "0.3.0",
  git: "git@github.com:cfly15/meteor-manage-users.git"
});

Package.on_use(function (api, where) {
  api.versionsFrom("METEOR@0.9.0");
	api.use('standard-app-packages', ['client', 'server']);
	api.use("alanning:roles@1.2.13", ['client', 'server']);

	api.add_files('libs/user_query.js', ['client', 'server']);

	api.add_files('client/startup.js', 'client');
	api.add_files('client/accounts_admin.html', 'client');
	api.add_files('client/accounts_admin.js', 'client');
	api.add_files('client/delete_account_modal.html', 'client');
	api.add_files('client/delete_account_modal.js', 'client');
	api.add_files('client/info_account_modal.html', 'client');
	api.add_files('client/info_account_modal.js', 'client');
	api.add_files('client/update_account_modal.html', 'client');
	api.add_files('client/update_account_modal.js', 'client');
	api.add_files('client/update_roles_modal.html', 'client');
	api.add_files('client/update_roles_modal.js', 'client');
	api.add_files('client/add_user_modal.html', 'client');
	api.add_files('client/add_user_modal.js', 'client');
	api.add_files('client/accounts_routes.js', 'client');

	api.add_files('style/style.css', 'client');

	api.add_files('server/startup.js', 'server');
	api.add_files('server/publish.js', 'server');
	api.add_files('server/methods.js', 'server');

	api.export('ManageUsers', ['server', 'client']);
});
<|endoftext|>


<commit_before>Package.describe({
  name: 'practicalmeteor:mocha-console-runner',
  version: '0.2.0-meteor-1.3-rc.1',
  summary: 'A mocha console reporter for running your package tests from the command line with spacejam.',
  git: 'https://github.com/practicalmeteor/meteor-mocha-console-reporter.git',
  // By default, Meteor will default to using README.md for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: 'README.md',
  testOnly: true
});

Package.onUse(function(api) {
  api.versionsFrom("1.3-rc.1");
  api.use(['coffeescript', "practicalmeteor:mocha@2.1.0-meteor-1.3-beta.16.1", 'practicalmeteor:loglevel@1.2.0_2', 'ecmascript']);
  api.imply("practicalmeteor:mocha@2.1.0-meteor-1.3-beta.16.1");
  api.mainModule('ConsoleReporter.coffee', 'client');
});

Package.onTest(function(api) {

});
<commit_msg>Update practicalmeteor:mocha dependency<commit_after>Package.describe({
  name: 'practicalmeteor:mocha-console-runner',
  version: '0.2.0-meteor-1.3-rc.1',
  summary: 'A mocha console reporter for running your package tests from the command line with spacejam.',
  git: 'https://github.com/practicalmeteor/meteor-mocha-console-reporter.git',
  // By default, Meteor will default to using README.md for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: 'README.md',
  testOnly: true
});

Package.onUse(function(api) {
  api.versionsFrom("1.3-rc.1");
  api.use(['coffeescript', "practicalmeteor:mocha@2.1.0-meteor-1.3-rc.1", 'practicalmeteor:loglevel@1.2.0_2', 'ecmascript']);
  api.imply("practicalmeteor:mocha@2.1.0-meteor-1.3-rc.1");
  api.mainModule('ConsoleReporter.coffee', 'client');
});

Package.onTest(function(api) {

});
<|endoftext|>


<commit_before>Package.describe({
  summary: 'Accounts Templates styled for Semantic UI.',
  version: '1.12.3',
  name: 'useraccounts:semantic-ui',
  git: 'https://github.com/meteor-useraccounts/semantic-ui.git',
});

Package.on_use(function(api, where) {
  api.versionsFrom('METEOR@1.0');

  api.use([
    'templating',
    'underscore',
  ], 'client');

  api.use([
    'useraccounts:core',
  ], ['client', 'server']);

  // Requires all routing packages loads before this asking for weak dependencies.
  api.use('useraccounts:flow-routing@1.12.1', ['client', 'server'], {weak: true});
  api.use('useraccounts:iron-routing@1.12.1', ['client', 'server'], {weak: true});

  api.imply([
    'useraccounts:core@1.12.3',
  ], ['client', 'server']);

  api.add_files([
    'lib/at_error.html',
    'lib/at_error.js',
    'lib/at_form.html',
    'lib/at_form.js',
    'lib/at_input.html',
    'lib/at_input.js',
    'lib/at_message.html',
    'lib/at_message.js',
    'lib/at_nav_button.html',
    'lib/at_nav_button.js',
    'lib/at_oauth.html',
    'lib/at_oauth.js',
    'lib/at_pwd_form.html',
    'lib/at_pwd_form.js',
    'lib/at_pwd_form_btn.html',
    'lib/at_pwd_form_btn.js',
    'lib/at_pwd_link.html',
    'lib/at_pwd_link.js',
    'lib/at_reCaptcha.html',
    'lib/at_reCaptcha.js',
    'lib/at_result.html',
    'lib/at_result.js',
    'lib/at_sep.html',
    'lib/at_sep.js',
    'lib/at_signin_link.html',
    'lib/at_signin_link.js',
    'lib/at_signup_link.html',
    'lib/at_signup_link.js',
    'lib/at_social.html',
    'lib/at_social.js',
    'lib/at_terms_link.html',
    'lib/at_terms_link.js',
    'lib/at_resend_verification_email_link.html',
    'lib/at_resend_verification_email_link.js',
    'lib/at_title.html',
    'lib/at_title.js',
    'lib/full_page_at_form.html',
    'lib/at_semantic-ui.css',
  ], ['client']);
});

Package.on_test(function(api) {
  api.use([
    'useraccounts:semantic-ui',
    'useraccounts:core@1.12.3',
  ]);

  api.use([
    'accounts-password',
    'tinytest',
    'test-helpers'
  ], ['client', 'server']);

  api.add_files([
    'tests/tests.js'
  ], ['client', 'server']);
});
<commit_msg>patch release - Bump to version 1.12.4<commit_after>Package.describe({
  summary: 'Accounts Templates styled for Semantic UI.',
  version: '1.12.4',
  name: 'useraccounts:semantic-ui',
  git: 'https://github.com/meteor-useraccounts/semantic-ui.git',
});

Package.on_use(function(api, where) {
  api.versionsFrom('METEOR@1.0');

  api.use([
    'templating',
    'underscore',
  ], 'client');

  api.use([
    'useraccounts:core',
  ], ['client', 'server']);

  // Requires all routing packages loads before this asking for weak dependencies.
  api.use('useraccounts:flow-routing@1.12.1', ['client', 'server'], {weak: true});
  api.use('useraccounts:iron-routing@1.12.1', ['client', 'server'], {weak: true});

  api.imply([
    'useraccounts:core@1.12.4',
  ], ['client', 'server']);

  api.add_files([
    'lib/at_error.html',
    'lib/at_error.js',
    'lib/at_form.html',
    'lib/at_form.js',
    'lib/at_input.html',
    'lib/at_input.js',
    'lib/at_message.html',
    'lib/at_message.js',
    'lib/at_nav_button.html',
    'lib/at_nav_button.js',
    'lib/at_oauth.html',
    'lib/at_oauth.js',
    'lib/at_pwd_form.html',
    'lib/at_pwd_form.js',
    'lib/at_pwd_form_btn.html',
    'lib/at_pwd_form_btn.js',
    'lib/at_pwd_link.html',
    'lib/at_pwd_link.js',
    'lib/at_reCaptcha.html',
    'lib/at_reCaptcha.js',
    'lib/at_result.html',
    'lib/at_result.js',
    'lib/at_sep.html',
    'lib/at_sep.js',
    'lib/at_signin_link.html',
    'lib/at_signin_link.js',
    'lib/at_signup_link.html',
    'lib/at_signup_link.js',
    'lib/at_social.html',
    'lib/at_social.js',
    'lib/at_terms_link.html',
    'lib/at_terms_link.js',
    'lib/at_resend_verification_email_link.html',
    'lib/at_resend_verification_email_link.js',
    'lib/at_title.html',
    'lib/at_title.js',
    'lib/full_page_at_form.html',
    'lib/at_semantic-ui.css',
  ], ['client']);
});

Package.on_test(function(api) {
  api.use([
    'useraccounts:semantic-ui',
    'useraccounts:core@1.12.4',
  ]);

  api.use([
    'accounts-password',
    'tinytest',
    'test-helpers'
  ], ['client', 'server']);

  api.add_files([
    'tests/tests.js'
  ], ['client', 'server']);
});
<|endoftext|>


<commit_before>Package.describe({
  name: 'ox2:buttons',
  summary: 'Button styles',
  version: '1.0.0',
  git: ' /* Fill me in! */ '
});

var S = 'server';
var C = 'client';
var CS = [C, S];

Package.onUse(function(api) {
  api.versionsFrom('1.0.2.1');
  // 3rd party
  api.use([
    'lauricio:less-autoprefixer@1.0.7'
    ]);
  api.addFiles('lib/oo-color-variables.import.less', C);
  api.addFiles('lib/oo-buttons.less', C);
});

Package.onTest(function(api) {
  api.use('tinytest');
  api.use('ox2:buttons');
  api.addFiles('tests/00-buttons-tests.js');
});
<commit_msg>fixed bad test filename<commit_after>Package.describe({
  name: 'ox2:buttons',
  summary: 'Button styles',
  version: '1.0.0',
  git: ' /* Fill me in! */ '
});

var S = 'server';
var C = 'client';
var CS = [C, S];

Package.onUse(function(api) {
  api.versionsFrom('1.0.2.1');
  // 3rd party
  api.use([
    'lauricio:less-autoprefixer@1.0.7'
    ]);
  api.addFiles('lib/oo-color-variables.import.less', C);
  api.addFiles('lib/oo-buttons.less', C);
});

Package.onTest(function(api) {
  api.use('tinytest');
  api.use('ox2:buttons');
  api.addFiles('tests/oo-buttons-tests.js');
});
<|endoftext|>


<commit_before>Package.describe({
  name: 'babrahams:editable-text-wysiwyg-bootstrap-2',
  summary: 'Extends the babrahams:editable-text package to include a wysiwyg editor',
  version: '0.6.13',
  git: 'https://github.com/jackadams/meteor-editable-text-wysiwyg-bootstrap-2.git'
});

Package.onUse(function(api) {

  api.versionsFrom('1.0');

  api.use('babrahams:editable-text@0.9.10', ['client', 'server']);
  api.imply('babrahams:editable-text');
  api.use('babrahams:editable-text-wysiwyg@0.6.13', 'client');
  api.use('templating', 'client');
  api.use('blaze', 'client');
  api.use('spacebars', 'client');
  api.use('jquery', 'client');

  api.add_files('lib/editable_text_wysiwyg_bootstrap_2.css', 'client');
  api.add_files('lib/editable_text_wysiwyg_bootstrap_2.html', 'client');
  api.add_files('lib/editable_text_wysiwyg_bootstrap_2.js', 'client');

});

Package.onTest(function(api) {
  api.use('tinytest');
  api.use('babrahams:editable-text-wysiwyg-bootstrap-2');
  api.addFiles('editable-text-wysiwyg-tests.js');
});<commit_msg>Update package.js<commit_after>Package.describe({
  name: 'babrahams:editable-text-wysiwyg-bootstrap-2',
  summary: 'Extends the babrahams:editable-text package to include a wysiwyg editor',
  version: '0.6.14',
  git: 'https://github.com/jackadams/meteor-editable-text-wysiwyg-bootstrap-2.git'
});

Package.onUse(function(api) {

  api.versionsFrom('1.0');

  api.use('babrahams:editable-text@0.9.11', ['client', 'server']);
  api.imply('babrahams:editable-text');
  api.use('babrahams:editable-text-wysiwyg@0.6.14', 'client');
  api.use('templating', 'client');
  api.use('blaze', 'client');
  api.use('spacebars', 'client');
  api.use('jquery', 'client');

  api.add_files('lib/editable_text_wysiwyg_bootstrap_2.css', 'client');
  api.add_files('lib/editable_text_wysiwyg_bootstrap_2.html', 'client');
  api.add_files('lib/editable_text_wysiwyg_bootstrap_2.js', 'client');

});

Package.onTest(function(api) {
  api.use('tinytest');
  api.use('babrahams:editable-text-wysiwyg-bootstrap-2');
  api.addFiles('editable-text-wysiwyg-tests.js');
});<|endoftext|>


<commit_before>Package.describe({
  name: 'jagi:astronomy-simple-validators',
  version: '0.2.1',
  summary: 'Simple validators for Meteor Astronomy',
  git: 'https://github.com/jagi/meteor-astronomy-simple-validators.git'
});

Package.onUse(function(api) {
  api.versionsFrom('1.1.0.2');

  api.use('jagi:astronomy@0.4.0');
  api.use('jagi:astronomy-validators@0.4.1');
  api.use('underscore');

  // Module.
  api.addFiles('lib/module/schema.js', ['client', 'server']);
  api.addFiles('lib/module/parser.js', ['client', 'server']);
  api.addFiles('lib/module/module.js', ['client', 'server']);
});
<commit_msg>Bump Astronomy version number<commit_after>Package.describe({
  name: 'jagi:astronomy-simple-validators',
  version: '0.2.1',
  summary: 'Simple validators for Meteor Astronomy',
  git: 'https://github.com/jagi/meteor-astronomy-simple-validators.git'
});

Package.onUse(function(api) {
  api.versionsFrom('1.1.0.2');

  api.use('jagi:astronomy@0.4.1');
  api.use('jagi:astronomy-validators@0.4.1');
  api.use('underscore');

  // Module.
  api.addFiles('lib/module/schema.js', ['client', 'server']);
  api.addFiles('lib/module/parser.js', ['client', 'server']);
  api.addFiles('lib/module/module.js', ['client', 'server']);
});
<|endoftext|>


<commit_before>// package metadata file for Meteor.js

Package.describe({
  name: 'materialize:materialize',  // http://atmospherejs.com/materialize/materialize
  summary: 'Materialize (official): A modern responsive front-end framework based on Material Design',
  version: '1.0.0-beta',
  git: 'https://github.com/Dogfalo/materialize.git'
});

Package.onUse(function (api) {
  api.versionsFrom('METEOR@1.0');

  api.use('fourseven:scss@4.5.4');

  api.addFiles([
    'dist/js/materialize.js'
  ], 'client');

  var scssFiles = [
    'sass/components/forms/_checkboxes.scss',
    'sass/components/forms/_file-input.scss',
    'sass/components/forms/_forms.scss',
    'sass/components/forms/_input-fields.scss',
    'sass/components/forms/_radio-buttons.scss',
    'sass/components/forms/_range.scss',
    'sass/components/forms/_select.scss',
    'sass/components/forms/_switches.scss',
    'sass/components/_badges.scss',
    'sass/components/_buttons.scss',
    'sass/components/_cards.scss',
    'sass/components/_carousel.scss',
    'sass/components/_chips.scss',
    'sass/components/_collapsible.scss',
    'sass/components/_color-classes.scss',
    'sass/components/_color-variables.scss',
    'sass/components/_datepicker.scss',
    'sass/components/_dropdown.scss',
    'sass/components/_global.scss',
    'sass/components/_grid.scss',
    'sass/components/_icons-material-design.scss',
    'sass/components/_materialbox.scss',
    'sass/components/_modal.scss',
    'sass/components/_navbar.scss',
    'sass/components/_normalize.scss',
    'sass/components/_preloader.scss',
    'sass/components/_pulse.scss',
    'sass/components/_sidenav.scss',
    'sass/components/_slider.scss',
    'sass/components/_table_of_contents.scss',
    'sass/components/_tabs.scss',
    'sass/components/_tapTarget.scss',
    'sass/components/_timepicker.scss',
    'sass/components/_toast.scss',
    'sass/components/_tooltip.scss',
    'sass/components/_transitions.scss',
    'sass/components/_typography.scss',
    'sass/components/_variables.scss',
    'sass/components/_waves.scss',
    'sass/materialize.scss'
  ];

  api.addFiles(scssFiles, 'client', { isImport: true });

  api.export('Materialize', 'client');
});
<commit_msg>Export M for meteor package instead of the old Materialize variable<commit_after>// package metadata file for Meteor.js

Package.describe({
  name: 'materialize:materialize',  // http://atmospherejs.com/materialize/materialize
  summary: 'Materialize (official): A modern responsive front-end framework based on Material Design',
  version: '1.0.0-beta',
  git: 'https://github.com/Dogfalo/materialize.git'
});

Package.onUse(function (api) {
  api.versionsFrom('METEOR@1.0');

  api.use('fourseven:scss@4.5.4');

  api.addFiles([
    'dist/js/materialize.js'
  ], 'client');

  var scssFiles = [
    'sass/components/forms/_checkboxes.scss',
    'sass/components/forms/_file-input.scss',
    'sass/components/forms/_forms.scss',
    'sass/components/forms/_input-fields.scss',
    'sass/components/forms/_radio-buttons.scss',
    'sass/components/forms/_range.scss',
    'sass/components/forms/_select.scss',
    'sass/components/forms/_switches.scss',
    'sass/components/_badges.scss',
    'sass/components/_buttons.scss',
    'sass/components/_cards.scss',
    'sass/components/_carousel.scss',
    'sass/components/_chips.scss',
    'sass/components/_collapsible.scss',
    'sass/components/_color-classes.scss',
    'sass/components/_color-variables.scss',
    'sass/components/_datepicker.scss',
    'sass/components/_dropdown.scss',
    'sass/components/_global.scss',
    'sass/components/_grid.scss',
    'sass/components/_icons-material-design.scss',
    'sass/components/_materialbox.scss',
    'sass/components/_modal.scss',
    'sass/components/_navbar.scss',
    'sass/components/_normalize.scss',
    'sass/components/_preloader.scss',
    'sass/components/_pulse.scss',
    'sass/components/_sidenav.scss',
    'sass/components/_slider.scss',
    'sass/components/_table_of_contents.scss',
    'sass/components/_tabs.scss',
    'sass/components/_tapTarget.scss',
    'sass/components/_timepicker.scss',
    'sass/components/_toast.scss',
    'sass/components/_tooltip.scss',
    'sass/components/_transitions.scss',
    'sass/components/_typography.scss',
    'sass/components/_variables.scss',
    'sass/components/_waves.scss',
    'sass/materialize.scss'
  ];

  api.addFiles(scssFiles, 'client', { isImport: true });

  api.export('M', 'client');
});
<|endoftext|>


<commit_before>Package.describe({
  name: "okgrow:analytics",
  version: "1.0.10",
  summary: "Complete Google Analytics, Mixpanel, KISSmetrics (and more) integration for Meteor",
  git: "https://github.com/okgrow/analytics",
  documentation: "README.md",
});

Npm.depends({
  underscore: "1.8.3",
});

Package.onUse(function (api) {
  api.versionsFrom("1.0.3.1");
  api.use("mongo");
  api.use("accounts-base", ["client", "server"], { weak: true });
  api.use("browser-policy-content", "server", { weak: true });

  // weak dependencies indicate we will load after the following packages
  // and constrain their versions IF another package, or app brings them in
  api.use("iron:router@1.0.7", "client", { weak: true });
  api.use("meteorhacks:flow-router@1.17.2", "client", { weak: true });
  api.use("kadira:flow-router@2.6.0", "client", { weak: true });

  api.addFiles([
    "server/browser-policy.js",
    "server/publications.js",
  ], "server");
  api.addFiles([
    "vendor/analytics.min.js",
    "client/collections.js",
    "client/meteor-analytics.js",
  ], "client");
});
<commit_msg>Updated package.js for 1.3 imports syntax<commit_after>Package.describe({
  name: "okgrow:analytics",
  version: "1.0.10",
  summary: "Complete Google Analytics, Mixpanel, KISSmetrics (and more) integration for Meteor",
  git: "https://github.com/okgrow/analytics",
  documentation: "README.md",
});

Npm.depends({
  underscore: "1.8.3",
});

Package.onUse(function (api) {
  api.versionsFrom("1.0.3.1");

  // "ecmascript" is mandatory dependency to compile our es6.
  api.use("ecmascript");
  api.use("es5-shim");

  // weak dependencies indicate we will load after the following packages.
  api.use("accounts-base", ["client", "server"], { weak: true });
  api.use("browser-policy-content", "server", { weak: true });

  // constrain their versions IF another package, or app brings them in.
  api.use("iron:router@1.0.7", "client", { weak: true });
  api.use("meteorhacks:flow-router@1.17.2", "client", { weak: true });
  api.use("kadira:flow-router@2.6.0", "client", { weak: true });

  api.mainModule("client-main.js", "client");
  api.mainModule("server-main.js", "server");

  // For backward compatibility.
  api.export("analytics", ["client", "server"]);
});
<|endoftext|>


<commit_before>/*
Copyright 2014-2015 Tulip Interfaces, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

Package.describe({
    summary: "Helpers for writing unit tests with Munit",
    version: "0.3.4",
    name: "tulip:munit-helpers",
    git: "https://github.com/tulip/munit-helpers.git"
});

Package.onUse(function (api) {
    "use strict";

    api.versionsFrom("1.2.0.2");

    api.use([
        "blaze",
        "check",
        "ddp",
        "ddp-common",
        "ejson",
        "htmljs",
        "jquery",
        "minimongo",
        "mongo",
        "random",
        "templating",
        "test-helpers",
        "tracker",
        "underscore",

        "practicalmeteor:munit@2.1.5"
    ]);

    api.use([
        "iron:layout@1.0.8"
    ], {weak: true});

    api.imply("practicalmeteor:munit");

    // common files
    api.addFiles([
        "munit_helpers.js",

        "lib/chai-stats.js",
        "lib/lolex.js",

        "common/auth.js",
        "common/collections.js",
        "common/deep_match.js",
        "common/stub_properties.js",
        "common/stub_date.js"
    ]);

    // client-only files
    api.addFiles([
        "client/auth.js",
        "client/methods.js",
        "client/templates.js",
        "lib/chai-jquery.js"
    ], "client");

    // server-only files
    api.addFiles([
        "server/acl.js",
        "server/connection.js",
        "server/methods.js",
        "server/publications.js"
    ], "server");

    // exports
    api.export("MunitHelpers");
});

Package.onTest(function(api) {
    "use strict";

    api.use([
        "accounts-base",
        "check",
        "minimongo",
        "mongo",
        "random",
        "reactive-var",
        "templating",
        "tracker",
        "underscore",

        "tulip:munit-helpers",
        "iron:router@1.0.8"
    ]);

    api.addFiles([
        "tests/common/auth_tests.js",
        "tests/common/collections_tests.js",
        "tests/common/deep_match_tests.js",
        "tests/common/methods_tests.js",
        "tests/common/stub_date_tests.js",
        "tests/common/stub_properties_tests.js"
    ]);

    api.addFiles([
        "tests/client/auth_tests.js",
        "tests/client/templates_tests.html",
        "tests/client/templates_tests.js"
    ], "client");

    api.addFiles([
        "tests/server/acl_tests.js",
        "tests/server/connection_tests.js",
        "tests/server/publications_tests.js"
    ], "server");

});

<commit_msg>Bump version<commit_after>/*
Copyright 2014-2015 Tulip Interfaces, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

Package.describe({
    summary: "Helpers for writing unit tests with Munit",
    version: "0.3.5",
    name: "tulip:munit-helpers",
    git: "https://github.com/tulip/munit-helpers.git"
});

Package.onUse(function (api) {
    "use strict";

    api.versionsFrom("1.2.0.2");

    api.use([
        "blaze",
        "check",
        "ddp",
        "ddp-common",
        "ejson",
        "htmljs",
        "jquery",
        "minimongo",
        "mongo",
        "random",
        "templating",
        "test-helpers",
        "tracker",
        "underscore",

        "practicalmeteor:munit@2.1.5"
    ]);

    api.use([
        "iron:layout@1.0.8"
    ], {weak: true});

    api.imply("practicalmeteor:munit");

    // common files
    api.addFiles([
        "munit_helpers.js",

        "lib/chai-stats.js",
        "lib/lolex.js",

        "common/auth.js",
        "common/collections.js",
        "common/deep_match.js",
        "common/stub_properties.js",
        "common/stub_date.js"
    ]);

    // client-only files
    api.addFiles([
        "client/auth.js",
        "client/methods.js",
        "client/templates.js",
        "lib/chai-jquery.js"
    ], "client");

    // server-only files
    api.addFiles([
        "server/acl.js",
        "server/connection.js",
        "server/methods.js",
        "server/publications.js"
    ], "server");

    // exports
    api.export("MunitHelpers");
});

Package.onTest(function(api) {
    "use strict";

    api.use([
        "accounts-base",
        "check",
        "minimongo",
        "mongo",
        "random",
        "reactive-var",
        "templating",
        "tracker",
        "underscore",

        "tulip:munit-helpers",
        "iron:router@1.0.8"
    ]);

    api.addFiles([
        "tests/common/auth_tests.js",
        "tests/common/collections_tests.js",
        "tests/common/deep_match_tests.js",
        "tests/common/methods_tests.js",
        "tests/common/stub_date_tests.js",
        "tests/common/stub_properties_tests.js"
    ]);

    api.addFiles([
        "tests/client/auth_tests.js",
        "tests/client/templates_tests.html",
        "tests/client/templates_tests.js"
    ], "client");

    api.addFiles([
        "tests/server/acl_tests.js",
        "tests/server/connection_tests.js",
        "tests/server/publications_tests.js"
    ], "server");

});

<|endoftext|>


<commit_before>Package.describe({
  name: 'rcdelfin:accounts-mautic',
  summary: "Accounts service for Mautic accounts",
  version: "0.0.1",
  git: "https://github.com/PoBuchi/meteor-accounts-mautic.git"
});

Package.onUse(function(api) {
  api.use('accounts-base', ['client', 'server']);
  api.imply('accounts-base', ['client', 'server']);

  api.use('accounts-oauth', ['client', 'server']);
  api.use('rcdelfin:mautic', ['client', 'server']);

  api.addFiles(['mautic_login_button.css'], 'client');
  api.addFiles('mautic_common.js', ['client', 'server']);
  api.addFiles('mautic_server.js', 'server');
  api.addFiles('mautic_client.js', 'client');
});

Package.onTest(function(api) {
  api.use('tinytest');
  api.use('autopublish');
  api.use('http', ['server']);
  api.use('ryepdx:linkedin-fake@0.0.4');
  api.use('rcdelfin:accounts-mautic');

  api.addFiles('mautic_client_tests.js', 'client');
  api.addFiles('mautic_server_tests.js', 'server');
});
<commit_msg>Set Meteor version<commit_after>Package.describe({
  name: 'rcdelfin:accounts-mautic',
  summary: "Accounts service for Mautic accounts",
  version: "0.0.1",
  git: "https://github.com/PoBuchi/meteor-accounts-mautic.git"
});

Package.onUse(function(api) {
  api.use('accounts-base', ['client', 'server']);
  api.imply('accounts-base', ['client', 'server']);

  api.use('accounts-oauth', ['client', 'server']);
  api.use('rcdelfin:mautic', ['client', 'server']);

  api.addFiles(['mautic_login_button.css'], 'client');
  api.addFiles('mautic_common.js', ['client', 'server']);
  api.addFiles('mautic_server.js', 'server');
  api.addFiles('mautic_client.js', 'client');
});

Package.onTest(function(api) {
  api.versionsFrom('1.2.1');
  api.use('tinytest');
  api.use('autopublish');
  api.use('http', ['server']);
  api.use('ryepdx:linkedin-fake@0.0.4');
  api.use('rcdelfin:accounts-mautic');

  api.addFiles('mautic_client_tests.js', 'client');
  api.addFiles('mautic_server_tests.js', 'server');
});
<|endoftext|>