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

IF3110-K23 submission commit #40

Open
wants to merge 1 commit 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
71 changes: 71 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="SimpleBlogJava" default="default" basedir=".">
<description>Builds, tests, and runs the project SimpleBlogJava.</description>
<import file="nbproject/build-impl.xml"/>
<!--

There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:

-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-dist: called before archive building
-post-dist: called after archive building
-post-clean: called after cleaning build products
-pre-run-deploy: called before deploying
-post-run-deploy: called after deploying

Example of pluging an obfuscator after the compilation could look like

<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>

For list of available properties check the imported
nbproject/build-impl.xml file.


Other way how to customize the build is by overriding existing main targets.
The target of interest are:

init-macrodef-javac: defines macro for javac compilation
init-macrodef-junit: defines macro for junit execution
init-macrodef-debug: defines macro for class debugging
do-dist: archive building
run: execution of project
javadoc-build: javadoc generation

Example of overriding the target for project execution could look like

<target name="run" depends="<PROJNAME>-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>

Notice that overridden target depends on jar target and not only on
compile target as regular run target does. Again, for list of available
properties which you can use check the target you are overriding in
nbproject/build-impl.xml file.

-->
</project>
2 changes: 2 additions & 0 deletions build/web/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

2 changes: 2 additions & 0 deletions build/web/META-INF/context.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/SimpleBlogJava"/>
Empty file.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
56 changes: 56 additions & 0 deletions build/web/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<servlet>
<servlet-name>GetBlogPost</servlet-name>
<servlet-class>com.simpleblogjava.GetBlogPost</servlet-class>
</servlet>
<servlet>
<servlet-name>Post</servlet-name>
<servlet-class>com.simpleblogjava.Post</servlet-class>
</servlet>
<servlet>
<servlet-name>AddBlog</servlet-name>
<servlet-class>com.simpleblogjava.AddBlog</servlet-class>
</servlet>
<servlet>
<servlet-name>LoadComments</servlet-name>
<servlet-class>com.simpleblogjava.LoadComments</servlet-class>
</servlet>
<servlet>
<servlet-name>UpdateBlog</servlet-name>
<servlet-class>com.simpleblogjava.UpdateBlog</servlet-class>
</servlet>
<servlet>
<servlet-name>Delete</servlet-name>
<servlet-class>com.simpleblogjava.Delete</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>GetBlogPost</servlet-name>
<url-pattern>/GetBlogPost</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Post</servlet-name>
<url-pattern>/Post</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AddBlog</servlet-name>
<url-pattern>/AddBlog</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>LoadComments</servlet-name>
<url-pattern>/LoadComments</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>UpdateBlog</servlet-name>
<url-pattern>/UpdateBlog</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Delete</servlet-name>
<url-pattern>/Delete</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
File renamed without changes.
File renamed without changes.
File renamed without changes
144 changes: 144 additions & 0 deletions build/web/assets/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
var isMobile;

// Identify if visitor on mobile with lame sniffing to remove parallaxing title
if( navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/BlackBerry/)
){
isMobile = true;
}

$(document).ready(function() {

// Global vars
var $artHeaderInner = $('.art-header-inner');
var $artHeader = $('.art-header');
var $artTitle = $('.art-title');
var $artSubtitle = $('.art-subtitle');
var $artTime = $('.art-time');
var artTitleFontSize = parseInt($artTitle.css('font-size'));
var $nav = $('.nav');
var windowScroll;

// Apply Fittext to article titles to make it scale responsively in a smooth fashion
$artTitle.fitText(1, { minFontSize: '34px' });

// Identify if visitor has a large enough viewport for parallaxing title
function isLargeViewport() {
if($nav.css('position') == "relative") {
return false;
} else {
return true;
}
}

// If large viewport and not mobile, parallax the title
if(!isMobile) {
$(window).scroll(function() {
if(isLargeViewport()) {
slidingTitle();
}
});
}

// Window gets large enough, need to recalc all parallaxing title values
$(window).resize(function() {
if(isLargeViewport()) {
slidingTitle();
}
});

// Functional parallaxing calculations
function slidingTitle() {
//Get scroll position of window
windowScroll = $(this).scrollTop();

//Slow scroll of .art-header-inner scroll and fade it out
$artHeaderInner.css({
'margin-top' : -(windowScroll/3)+"px",
'opacity' : 1-(windowScroll/550)
});

//Slowly parallax the background of .art-header
$artHeader.css({
'background-position' : 'center ' + (-windowScroll/8)+"px"
});

//Fade the .nav out
$nav.css({
'opacity' : 1-(windowScroll/400)
});
}

// Link to top of page without changing URL
$('.back-to-top a').click(function(e) {
e.preventDefault();
$(window).scrollTop(0);
})

// Cover image of the header
var $postImage = $('img[alt="cover"]');
if ( $postImage.length ) {
var postImageURL = $postImage.attr('src');
$('.art-header').css('background-image','url(' + postImageURL + ')');
$('.art-header').css('background-size','100%');

// Change color scheme to white
$('#logo h1').css('color','white');
$('.art-title').css('color','white');
$('.art-subtitle').css('color','white');
$('.art-time').css('color','white');
$('.nav-primary li a').css('color','white');

// Add Text Shadows
$('.art-title').css('text-shadow','3px 3px 0 rgba(0,0,0,0.1), -1px -1px 0 rgba(0,0,0,0.1), 1px -1px 0 rgba(0,0,0,0.1), -1px 1px 0 rgba(0,0,0,0.1), 1px 1px 0 rgba(0,0,0,0.1)');
$('.art-subtitle').css('text-shadow','3px 3px 0 rgba(0,0,0,0.1), -1px -1px 0 rgba(0,0,0,0.1), 1px -1px 0 rgba(0,0,0,0.1), -1px 1px 0 rgba(0,0,0,0.1), 1px 1px 0 rgba(0,0,0,0.1)');
$('.art-time').css('text-shadow','3px 3px 0 rgba(0,0,0,0.1), -1px -1px 0 rgba(0,0,0,0.1), 1px -1px 0 rgba(0,0,0,0.1), -1px 1px 0 rgba(0,0,0,0.1), 1px 1px 0 rgba(0,0,0,0.1)');

}
$postImage.remove();

// Subtitles
var $subtitle = $('span[id="subtitle"]');
if ( $subtitle.length ) {
var subtitleText = $('#subtitle').text();
$('.art-subtitle').html(subtitleText);

}
$subtitle.remove();

// Make punctuation smarter
jQuery.fn.smarten = (function() {

function smartenNode(node) {
if (node.nodeType === 3) {
node.data = node.data
.replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018") // Opening singles
.replace(/'/g, "\u2019") // Closing singles & apostrophes
.replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201c") // Opening doubles
.replace(/"/g, "\u201d") // Closing doubles
.replace(/--/g, "\u2013") // En dashes
.replace(/---/g, "\u2014") // Em dashes
.replace(/\.{3}/g, "\u2026"); // Ellipsis
} else if (node.nodeType === 1) {
if (node = node.firstChild) do {
smartenNode(node);
} while (node = node.nextSibling);
}
}

return function() {
return this.each(function(){
smartenNode(this);
});
};

}());

// Instantiation
$('article').smarten();

});
46 changes: 46 additions & 0 deletions build/web/assets/js/fittext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*global jQuery */
/*!
* FitText.js 1.0
*
* Copyright 2011, Dave Rupert http://daverupert.com
* Released under the WTFPL license
* http://sam.zoy.org/wtfpl/
*
* Date: Thu May 05 14:23:00 2011 -0600
*/
$(document).ready(function() {

(function( $ ){

$.fn.fitText = function( kompressor, options ) {

// Setup options
var compressor = kompressor || 1,
settings = $.extend({
'minFontSize' : Number.NEGATIVE_INFINITY,
'maxFontSize' : Number.POSITIVE_INFINITY
}, options);

return this.each(function(){

// Store the object
var $this = $(this);

// Resizer() resizes items based on the object width divided by the compressor * 10
var resizer = function () {
$this.css('font-size', Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
};

// Call once to set.
resizer();

// Call on resize. Opera debounces their resize by default.
$(window).on('resize', resizer);

});

};

})( jQuery );

});
2 changes: 2 additions & 0 deletions build/web/assets/js/respond.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading