-
-
Save samdroid-apps/ad2edbbdb06b70470225 to your computer and use it in GitHub Desktop.
ASLO ideas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"activities": { | |
"bundle.id.of.the.thing" : { | |
"title": { | |
"en-US": "Turtle Art" | |
}, | |
"icon": "http://activities.sugarlabs.org/en-US/sugar/images/addon_icon/4027/1396971837", | |
"description": { | |
"en_US": "Turtle Blocks is an activity with a Logo-inspired graphical \"turtle\" that draws colorful art with snap-together visual programming elements. <br/> Turtle Blocks can be used to explore basic concepts in programming, mathematics, multimedia and design. A portfolio feature lets you use Turtle Blocks for making presentations. <br/> Turtle Blocks is intended to be a stepping stone to Logo, but there are many restrictions compared to Logo. Turtle Blocks was written by Brian Silverman and is maintained by Walter Bender and Raul Gutierrez. Arjun Sarwal added the sensor features. Tony Forster is the most inspired user." | |
}, | |
"screenshots": { | |
"en_US": ["http://activities.sugarlabs.org/en-US/sugar/images/p/8/1321708306"] | |
}, | |
"version": 201, | |
"whats_new": { | |
"en-US": "ENHANCEMENT: <br/> * New sample program: plot global tempuratures (temperature data from http://eesc.columbia.edu/courses/ees/climate/labs/globaltemp/data/global_temp.xls) <br/>BUG FIXES: <br/> * Fixed problem with turning off hover help (Alan Aguiar) <br/> * Fixed problem with starting plugins from exported Python code (w/ Cynthia Solomon) <br/> * FIxed problem with label offset (SL #4754)" | |
}, | |
"by": [ | |
{"name": "Walter", "page": "https://www.github.com/walterbender"} | |
], | |
"github_url": "walterbender/turtleart", | |
"github_current_tag": "v102" | |
}, | |
"org.sugarlabs.browse.or.whatever" : { | |
"title": { | |
"en-US": "Browse" | |
}, | |
"icon": "https://fancy.photo/hosting/site/icon2.svg", | |
"description": { | |
"en-US": "Whatever......." | |
}, | |
"screenshots": { | |
"en_US": ["hosted", "by", "http://you"] | |
}, | |
"version": 60, | |
"whats_new": { | |
"en-US": "Cool new stuff!" | |
}, | |
"by": [ | |
{"name": "Person", "page": "https://www.github.com/github"} | |
], | |
"xo_url": "https://get.your.own/file/host/or/ask/somebody/else.xo" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Sugar Activities</title> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/mustache.js/0.7.2/mustache.min.js"></script> | |
<script src="index.js"></script> | |
</head> | |
<body> | |
<ul class="activities"> | |
</ul> | |
<div class="detail" style="display: none;"> | |
<img class="icon"/><h1 class="title"></h1> | |
<div class="by"></div> | |
<div class="screenshots"></div> | |
<p class="description"></p> | |
<p class="whatsnew"></p> | |
<a class="download">Download</a><br/> | |
<a class="download-devel">Download Devel Version</a> | |
<a class="github">Help make the activity GitHub!</a> | |
<div id="disqus_thread"></div> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var activitiesData = {}; | |
var getLang = function ( obj ) { | |
var ul = navigator.language || navigator.userLanguage; | |
if ( obj[ ul ] !== undefined ) // Same | |
return obj[ ul ]; | |
for ( key in obj ) // Same lang, different country | |
if ( obj.hasOwnProperty( key ) ) | |
if ( key.substr( 0, 2 ) == ul.substr( 0, 2 ) ) | |
return obj[ key ]; | |
for ( key in obj ) // Anything | |
if ( obj.hasOwnProperty( key ) ) | |
return obj[ key ]; | |
}; | |
var baseUrl = "0.0.0.0:8000/"; | |
var disqusIsSetup = false; | |
var commentsSetup = function ( bundleId ) { | |
if ( !disqusIsSetup ) { | |
var disqus_shortname = 'aslodevelsamdroid'; // required: replace example with your forum shortname | |
var disqus_identifier = bundleId; | |
console.log( disqus_identifier ); | |
var disqus_url = baseUrl + "#!/view/" + bundleId; | |
/* * * DON'T EDIT BELOW THIS LINE * * */ | |
(function() { | |
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; | |
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; | |
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); | |
})(); | |
disqusIsSetup = true; | |
} else { | |
console.log( "Reset: " + bundleId ); | |
DISQUS.reset({ | |
reload: true, | |
config: function () { | |
this.page.identifier = bundleId; | |
this.page.url = baseUrl + "#!/view/" + bundleId; | |
} | |
}); | |
} | |
}; | |
var focusOnActivity = function ( data, bundleId ) { | |
window.location.hash = "!/view/" + bundleId; | |
var container = $( ".detail" ); | |
container.show(); | |
$( ".title", container ).html( getLang( data.title ) ); | |
$( ".icon", container ).attr( "src", data.icon ); | |
$( ".description", container ).html( getLang( data.description ) ); | |
$( ".whatsnew", container ).html( getLang( data.whats_new ) ); | |
if ( data.github_url !== undefined && data.github_current_tag !== undefined ) { | |
var url = "https://github.com/" + data.github_url | |
+ "/archive/" + data.github_current_tag + ".zip" | |
$( ".download", container ).attr( "href", url ); | |
$( ".download-devel", container ).show(); | |
url = "https://github.com/" + data.github_url + "/archive/master.zip" | |
$( ".download-devel", container ).attr( "href", url ); | |
$( ".github", container ).show(); | |
$( ".github", container ).attr( "href", "https://www.github.com/" + data.github_url ); | |
} else { | |
$( ".download", container ).attr( "href", data.xo_url ); | |
$( ".download-devel", container ).hide(); | |
$( ".github", container ).hide(); | |
} | |
$( ".screenshots", container).html( "" ); | |
for ( i in getLang( data.screenshots ) ) { | |
var ele = $( "<img>" ); | |
var imageSrc = getLang( data.screenshots )[ i ] | |
ele.addClass( "screenshot" ); | |
ele.attr( "src", imageSrc ); | |
$( ".screenshots", container ).append( ele ); | |
} | |
$( ".by", container).html( "" ); | |
for ( i in data.by ) { | |
var ele = $( "<a>" ); | |
var person = data.by[ i ]; | |
ele.attr( "href", person.page ); | |
ele.html( person.name ); | |
$( ".by", container ).append( ele ); | |
} | |
commentsSetup( bundleId ); | |
}; | |
var setupActivityList = function () { | |
for ( var key in activitiesData ) { | |
if ( activitiesData.hasOwnProperty( key ) ) { | |
var ele = $( "<li>" ); | |
var data = activitiesData[ key ]; | |
console.log( data ) | |
var title = $( "<h2>" + getLang( data.title ) + "</h2>" ); | |
ele.append( title ); | |
$( ".activities").append( ele ); | |
ele.data( "json", data ); | |
ele.data( "bundleId", key ); | |
ele.click( function () { | |
focusOnActivity( $( this ).data( "json" ), $( this ).data( "bundleId" ) ); | |
}); | |
} | |
} | |
}; | |
$(document).ready( function () { | |
var list = $(".activities"); | |
var detail = $(".detail"); | |
$.ajax({ | |
url: "data.json" | |
}).done( function ( data ) { | |
activitiesData = data.activities; | |
setupActivityList(); | |
if ( window.location.hash ) { | |
var bundleId = window.location.hash.substr( "!/view/".length + 1 ); | |
var itemData = activitiesData[ bundleId ]; | |
focusOnActivity( itemData, bundleId ); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment