App-DuckPAN
view release on metacpan or search on metacpan
Change: 0db34d5245cb576820a8a92c75219f35ed44b556
Author: Zaahir Moolla <moollaza@duckduckgo.com>
Date : 2015-02-11 20:37:16 +0000
Place error messages above mock results and ad
Change: 5c64df01126cae11528074ea2948f58d0cc849f9
Author: Zach Thompson <zach@duckduckgo.com>
Date : 2015-02-10 16:51:53 +0000
App::DuckPAN::Web: Add commment about removing setTimeout line when
javascript race condition is fixed.
Change: 274690d8f6cf0bd26feeb3621f67610922f1e75e
Author: Zaahir Moolla <moollaza@fastmail.fm>
Date : 2015-02-10 00:15:16 +0000
Merge pull request #220 from duckduckgo/zaahir/informative-install
Update install/reinstall message to be more clear
App::DuckPAN::Web: Goodies can have js as well, e.g. for Handlebars
helpers. duckpan.js: Check that it's a function first. Goodies with
javascript can generate errors here.
Change: fbf4093469e78b54c9bcbfd09331be27476a1e3f
Author: Zach Thompson <zach@duckduckgo.com>
Date : 2015-02-05 15:18:13 +0000
App::DuckPAN::Web: Modifications to allow custom goodie templates.
Note: still has race condition that needs to be addressed in the
javascript. For now, uses setTimeout with an arbitrary delay.
Change: 07ad2253db9a44941cfa3b289b109618a7408710
Author: Chris Wilson <chris@chrisjwilson.com>
Date : 2015-01-30 10:10:05 +0000
Merge pull request #218 from duckduckgo/zach/skip-share-reload
App::DuckPAN:Restart: Skip restarting server on changes to
.js|css|handlebars
lib/App/DuckPAN/Web.pm view on Meta::CPAN
my $calls_nrj = join('', map {
DDG::Meta::Data->get_js(id => $_)
|| qq(DDH.$_=DDH.$_||{};DDH.$_.meta={"tab":"Answer", "id":"$_"};)
} @ids);
my $calls_script = join('', map { q|<script type='text/JavaScript' src='| . $_ . q|'></script>| } @calls_script);
# For now we only allow a single goodie. If that changes, we will do the
# same join/map as with spices.
if(@calls_goodie){
my $goodie = shift @calls_goodie;
$calls_nrj .= "DDG.duckbar.future_signal_tab({signal:'high',from:'$goodie->{id}'});",
# Uncomment following line and remove "setTimeout" line when javascript race condition is addressed
# $calls_script = q|<script type="text/JavaScript">/*DDH.add(| . encode_json($goodie) . q|);*/</script>|;
$calls_script .= q|<script type="text/JavaScript">DDG.ready(function(){ window.setTimeout(DDH.add.bind(DDH, | . encode_json($goodie) . q|), 100)});</script>|;
}
elsif(@calls_fathead){
my $fathead = shift @calls_fathead;
# $calls_nrj .= "DDG.duckbar.future_signal_tab({signal:'high',from:'$fathead->{id}'});",
# Uncomment following line and remove "setTimeout" line when javascript race condition is addressed
# $calls_script = q|<script type="text/JavaScript">/*DDH.add(| . encode_json($fathead) . q|);*/</script>|;
$calls_script .= q|<script type="text/JavaScript">DDG.ready(function(){ window.setTimeout(DDH.add.bind(DDH, | . encode_json($fathead) . q|), 100)});</script>|;
}
else{
$calls_nrj .= @calls_nrj ? join(';', map { "nrj('".$_."')" } @calls_nrj) . ';' : '';
}
my $calls_nrc = @calls_nrc ? join(';', map { "nrc('".$_."')" } @calls_nrc) . ';' : '';
if (%calls_template) {
foreach my $spice_name ( keys %calls_template ){
$calls_script .= join("",map {
my $template_name = $_;
share/template_compiler.js view on Meta::CPAN
Spice[spiceName][templateName] = Handlebars.compile(content);
console.log('Compiled template: ', spiceName + '_' + templateName);
});
console.log('Finished compiling templates')
console.log('Now Spice obj: ', Spice);
// Need to wait a little for page JS to finish
// modifying the DOM
setTimeout(function(){
$.each(toCall, function(i, name){
var cbName = 'ddg_spice_' + name;
console.log('Executing: ' + cbName);
if (typeof window[cbName] == 'function'){
window[cbName]();
}
});
}, 100);
return;
( run in 0.259 second using v1.01-cache-2.11-cpan-4d50c553e7e )