Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS Update – further separate original forge.jquery.js functions into … #24

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,24 +171,34 @@ <h3>Contact</h3>
<!-- Touchswipe -->
<script type="text/javascript" src="js/lib/jquery.touchSwipe.min.js"></script>

<script type="text/javascript" src="js/lib/forge.jquery.js"></script>
<script type="text/javascript" src="js/lib/forge.jquery.js"></script>
<script type="text/javascript" src="js/lib/jbossorg-tabzilla.js"></script>
<!-- AngularJS -->
<script type="text/javascript" src="js/lib/angular.js"></script>
<script type="text/javascript" src="js/lib/angular-ui-router.min.js"></script>
<script type="text/javascript" src="js/lib/ui-route-styles.js"></script>

<!-- AngularJS Controllers-->
<!-- AngularJS Controllers -->
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/filters/sanitizeFilter.js"></script>
<script type="text/javascript" src="js/services/backendAPIService.js"></script>
<script type="text/javascript" src="js/value/configValue.js"></script>
<script type="text/javascript" src="js/controllers/rootCtrl.js"></script>
<script type="text/javascript" src="js/controllers/addonCtrl.js"></script>
<script type="text/javascript" src="js/controllers/communityCtrl.js"></script>
<script type="text/javascript" src="js/lib/forge.documentation.jquery.js"></script>
<script type="text/javascript" src="js/lib/forge.frontpage.jquery.js"></script>
<script type="text/javascript" src="js/lib/forge.docpage.jquery.js"></script>
<script type="text/javascript" src="js/lib/forge.community.jquery.js"></script>
<script type="text/javascript" src="js/lib/forge.addons.jquery.js"></script>
<script type="text/javascript" src="js/controllers/docCtrl.js"></script>
<script type="text/javascript" src="js/lib/forge.documentation.jquery.js"></script>
<script type="text/javascript" src="js/controllers/docMainCtrl.js"></script>
<script type="text/javascript" src="js/controllers/docJSCtrl.js"></script>
<script type="text/javascript" src="js/controllers/addonJSCtrl.js"></script>
<script type="text/javascript" src="js/controllers/frontJSCtrl.js"></script>
<script type="text/javascript" src="js/lib/forge.news.jquery.js"></script>
<script type="text/javascript" src="js/controllers/docMainCtrl.js"></script>
<script type="text/javascript" src="js/controllers/newsJSCtrl.js"></script>
<script type="text/javascript" src="js/controllers/communityJSCtrl.js"></script>
<script type="text/javascript" src="js/controllers/downloadCtrl.js"></script>
<script type="text/javascript" src="js/controllers/eventsCtrl.js"></script>
<script type="text/javascript" src="js/controllers/homeCtrl.js"></script>
Expand Down
10 changes: 10 additions & 0 deletions app/js/controllers/addonJSCtrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This control uses the JS in the js/lib/forge.addons.jquery.js script to:
// – Controls the heights of the addons boxes
// - Sets star ratings


angular.module('jboss-forge').controller('addOnGridCtrl',function($scope) {
$scope.$watch('$viewContentLoaded', function(){
setTimeout('initAddonSet()',200);
});
});
9 changes: 9 additions & 0 deletions app/js/controllers/communityJSCtrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This control uses the JS in the js/lib/forge.community.jquery.js script to:
// – Control the vertical bar spacing in the "So many Ways to contribute" marque &
// - Create the img/link grid

angular.module('jboss-forge').controller('communityGridCtrl',function($scope) {
$scope.$watch('$viewContentLoaded', function(){
setTimeout('initCommunity()',200);
});
});
8 changes: 8 additions & 0 deletions app/js/controllers/docJSCtrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This control uses the JS in the js/lib/forge.documentation.jquery.js script to:
// – Controls the heights of the two main columns on the news page to make them even.

angular.module('jboss-forge').controller('docPageJSCtrl',function($scope) {
$scope.$watch('$viewContentLoaded', function(){
setTimeout('docContentHeightFix()',500);
});
});
15 changes: 15 additions & 0 deletions app/js/controllers/frontJSCtrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This control uses the JS in the js/lib/forge.frontpage.jquery.js script to:
// – Controls the network display
// – Controls the alignment in the front "Works in the environment you use" section
angular.module('jboss-forge').controller('frontPgCols',function($scope) {
$scope.$watch('$viewContentLoaded', function(){
initFrontPageColSet();
});
});


angular.module('jboss-forge').controller('frontPgNetwork',function($scope) {
$scope.$watch('$viewContentLoaded', function(){
initFrontPageNetwork();
});
});
8 changes: 8 additions & 0 deletions app/js/controllers/newsJSCtrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This control uses the JS in the js/lib/forge.news.jquery.js script to:
// – Controls the heights of the two main columns on the news page to make them even.

angular.module('jboss-forge').controller('newsJSCtrl',function($scope) {
$scope.$watch('$viewContentLoaded', function(){
setTimeout('initNews()',500);
});
});
62 changes: 62 additions & 0 deletions app/js/lib/forge.addons.jquery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* Functions for use specifically on the front page of the site – these may use some of the main forge.jquery.js functions as well.
*/

initAddonSet();

// Init Rating Star display script
function initAddonSet() {
if($('.star-row').length) {
uniformAddonSizes();
addStars();
}
}


// Function to set a standard size for all the addon box descriptions (and by extension all the addon divs) based on largest description.
function uniformAddonSizes() {

var pHeightArr = new Array(); // For all the <p> tags in the rows.

// Gather heights of all <p> elements
$('.click-modal').each(function(i,e) {
pHeightArr.push($(this).children('p').height());
});

// Determine the largest height
var allHeight = Math.max.apply(Math,pHeightArr);

// Set the height to all <p> tags
$('.click-modal').each(function(i,e) {
$(this).children('p').css({'height':allHeight+'px'});
});
}



// Function to determine how many stars an addon has been rated.
// The function takes the data-rating value and changes that many stars for each row instance from grey to gold by adding the 'gold' class.
function addStars() {
$('.star-row').each(function(i,e) {
// First, insert 5 star glyphicons, with their default settings
var basicStar = '<span class="glyphicon glyphicon-star"> </span>';

var rating = $(this).attr('data-rating');

// Insert 5 star glyphicon span tags
for(i=0;i<5;i++) {
if(i==0) { $(this).html(basicStar);
} else
if(i>0) { $(this).children('span:last-child').after(basicStar); }
}

// This takes the data-rating value and loops through the inserted star icons to change the given number to gold.
if(rating > 0) {
var starCount = parseInt(rating) + 1;
for(i=0;i<starCount;i++) {
$(this).children('span:nth-child('+i+')').addClass('gold');
}
}

});
}
Loading