Index: trunk/extensions/Storyboard/tags/Storyboard/storyboard.js |
— | — | @@ -0,0 +1,87 @@ |
| 2 | + /** |
| 3 | + * Storyboard object. |
| 4 | + * |
| 5 | + * @file Storyboard.js |
| 6 | + * @ingroup Storyboard |
| 7 | + * |
| 8 | + * @author Jeroen De Dauw |
| 9 | + * @author Tha Devil (helpmij.nl) |
| 10 | + */ |
| 11 | + |
| 12 | +/** |
| 13 | + * Constructor for the Storyboard object. |
| 14 | + */ |
| 15 | +function Storyboard() { |
| 16 | + this.stories = []; |
| 17 | + |
| 18 | + this.pageNumber = 0; |
| 19 | + this.pageAmount = -1; |
| 20 | + |
| 21 | + this.isLoading = false; |
| 22 | +} |
| 23 | + |
| 24 | +/** |
| 25 | + * Scroll method. |
| 26 | + * Checks if new stories should be loaded, and calls loadAjax when this is the case. |
| 27 | + */ |
| 28 | +Storyboard.prototype.scroll = function(event) { |
| 29 | + var board = event.data[0]; |
| 30 | + var documentHeight = jQuery(document).height(); |
| 31 | + var top = jQuery("#storyboard").scrollTop(); |
| 32 | + |
| 33 | + var resultsHeight = 0; |
| 34 | + jQuery("#storyboard .storyboard-result").each(function() { |
| 35 | + resultsHeight += $(this).height(); |
| 36 | + }); |
| 37 | + |
| 38 | + var threshold = ( ( top / 2 ) + ( 0.01 * Math.pow(documentHeight, 2) ) ) / resultsHeight; |
| 39 | + if (threshold > 0.6) threshold = 0.6; |
| 40 | + |
| 41 | + if( top / resultsHeight >= threshold && !board.isLoading && board.pageNumber < board.pageAmount ) |
| 42 | + { |
| 43 | + board.loadAjax(); |
| 44 | + } |
| 45 | +}; |
| 46 | + |
| 47 | +/** |
| 48 | + * LoadAjax method. |
| 49 | + * Requests and loads new stories into the storyboard. |
| 50 | + */ |
| 51 | +Storyboard.prototype.loadAjax = function() { |
| 52 | + alert('load'); |
| 53 | + var t = this; |
| 54 | + |
| 55 | + this.isLoading = true; |
| 56 | + |
| 57 | + jQuery("#storyboard").append(jQuery("<div />").attr("id","storyboard-loading")); |
| 58 | + |
| 59 | + jQuery.getJSON(storyboardPath + '/tags/Storyboard/Stories.php?&number=' + t.currentPage + '', function(json) { |
| 60 | + |
| 61 | + t.pageAmount = json.pageAmount; |
| 62 | + t.stories.push(json); |
| 63 | + t.isLoading = false; |
| 64 | + |
| 65 | + jQuery("#storyboard-loading").remove(); |
| 66 | + |
| 67 | + t.display(); |
| 68 | + }); |
| 69 | +}; |
| 70 | + |
| 71 | +/** |
| 72 | + * Display method. |
| 73 | + * Creates the storyboard layout. |
| 74 | + */ |
| 75 | +Storyboard.prototype.display = function() { |
| 76 | + alert('display'); |
| 77 | +}; |
| 78 | + |
| 79 | +/** |
| 80 | + * Reload method. |
| 81 | + * Removes all stories from the storyboard and loads a new batch of stories. |
| 82 | + */ |
| 83 | +Storyboard.prototype.reload = function() { |
| 84 | + jQuery("#storyboard").html(""); |
| 85 | + this.stories = []; |
| 86 | + this.pageNumber = 0; |
| 87 | + this.loadAjax(); |
| 88 | +}; |
\ No newline at end of file |
Property changes on: trunk/extensions/Storyboard/tags/Storyboard/storyboard.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 89 | + native |
Index: trunk/extensions/Storyboard/tags/Storyboard/storyboard.css |
— | — | @@ -0,0 +1,93 @@ |
| 2 | +/** |
| 3 | + * Storyboard tag css. |
| 4 | + * |
| 5 | + * @file Storyboard.css |
| 6 | + * @ingroup Storyboard |
| 7 | + * |
| 8 | + * @author Jeroen De Dauw |
| 9 | + * @author Tha Devil (helpmij.nl) |
| 10 | + */ |
| 11 | + |
| 12 | +#storyboard |
| 13 | +{ |
| 14 | + margin-left: 31px; |
| 15 | + width: 50%; |
| 16 | + height: 300px; |
| 17 | + overflow-y: scroll; |
| 18 | + overflow-x: hidden; |
| 19 | + font-family: Verdana; |
| 20 | + font-size: 10px; |
| 21 | +} |
| 22 | + |
| 23 | +#storyboard-results |
| 24 | +{ |
| 25 | + background: url(extensions/Storyboard/images/storyboard-background.png) repeat-y; |
| 26 | +} |
| 27 | + |
| 28 | +.storyboard-result |
| 29 | +{ |
| 30 | + padding-bottom: 6px; |
| 31 | + background: url(extensions/Storyboard/images/storyboard-result-spacer.png) no-repeat bottom; |
| 32 | +} |
| 33 | + |
| 34 | +.storyboard-result .storyboard-header |
| 35 | +{ |
| 36 | + margin: 10px 0px 10px 15px; |
| 37 | +} |
| 38 | + |
| 39 | +.storyboard-result .storyboard-header .storyboard-title |
| 40 | +{ |
| 41 | + font: 16px "Lucida Sans", Verdana; |
| 42 | + font-weight: bold; |
| 43 | + width: 100px; |
| 44 | + height: 21px; |
| 45 | + overflow: hidden; |
| 46 | + float: left; |
| 47 | +} |
| 48 | + |
| 49 | +.storyboard-result |
| 50 | +{ |
| 51 | + margin-left: 12px; |
| 52 | + margin-right: 15px; |
| 53 | +} |
| 54 | + |
| 55 | +.storyboard-result |
| 56 | +{ |
| 57 | + float: left; |
| 58 | + width: 146px; |
| 59 | + height: 112px; |
| 60 | + margin-left: 3px; |
| 61 | + margin-right: 3px; |
| 62 | + margin-top: 10px; |
| 63 | + overflow: hidden; |
| 64 | + text-align: center; |
| 65 | +} |
| 66 | + |
| 67 | +.storyboard-result |
| 68 | +{ |
| 69 | + display: none; |
| 70 | +} |
| 71 | + |
| 72 | +#storyboard-loading |
| 73 | +{ |
| 74 | + background-image: url(extensions/Storyboard/images/storyboard-loader.gif); |
| 75 | + width:31px; |
| 76 | + height:31px; |
| 77 | + margin:0 auto; |
| 78 | + margin-top: 10px; |
| 79 | +} |
| 80 | + |
| 81 | +.storyboard-footer |
| 82 | +{ |
| 83 | + height: 40px; |
| 84 | + padding-top: 20px; |
| 85 | + margin-left: 15px; |
| 86 | +} |
| 87 | + |
| 88 | +.storyboard-sharing |
| 89 | +{ |
| 90 | + margin-left: 750px; |
| 91 | + height: 30px; |
| 92 | + width: 110px; |
| 93 | + float: left; |
| 94 | +} |
Property changes on: trunk/extensions/Storyboard/tags/Storyboard/storyboard.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 95 | + native |