Gruntify it all

This commit is contained in:
jaywood
2014-07-09 23:44:45 -04:00
parent 7864f0917e
commit 4cc6b498fd
7 changed files with 215 additions and 18 deletions

2
.gitignore vendored
View File

@ -26,4 +26,4 @@ dw_php_codehinting.config
#npm stuffs
node_modules/
.sass_cache
.sass-cache/

View File

@ -1,13 +1,55 @@
/* CSS Document */
.cwv3_box{background: transparent;}
.cwv3_box {
background: transparent;
}
/* Undocumented cBox colors */
#cboxLoadingOverlay, #cboxContent, #cboxLoadedContent{background-color: #FFF !important;}
#cwv3_auth{border: 3px solid #ccc; background: #FFF;}
#cwv3_auth div{padding: 0.25em}
#cwv3_title{color: #FFF; font-weight: bold; text-align:center; background: #f00;}
#cwv3_btns{overflow:hidden;}
#cwv3_btns div a{ display: block; width: 100%; text-align:center; color: #FFF; font-weight:bold; text-decoration:none;}
#cwv3_enter{float:left; width: 40%;}
#cwv3_enter a{background-color: #0C3;}
#cwv3_exit{float:right; width: 40%;}
#cwv3_exit a{background-color: #F00;}
#cboxLoadingOverlay, #cboxContent, #cboxLoadedContent {
background-color: #FFF !important;
}
#cwv3_auth {
border: 3px solid #ccc;
background: #FFF;
}
#cwv3_auth div {
padding: 0.25em;
}
#cwv3_title {
color: #FFF;
font-weight: bold;
text-align: center;
background: #f00;
}
#cwv3_btns {
overflow: hidden;
}
#cwv3_btns div a {
display: block;
width: 100%;
text-align: center;
color: #FFF;
font-weight: bold;
text-decoration: none;
}
#cwv3_enter {
float: left;
width: 40%;
}
#cwv3_enter a {
background-color: #0C3;
}
#cwv3_exit {
float: right;
width: 40%;
}
#cwv3_exit a {
background-color: #F00;
}

1
css/cwv3.min.css vendored Normal file
View File

@ -0,0 +1 @@
.cwv3_box{background:0 0}#cboxContent,#cboxLoadedContent,#cboxLoadingOverlay{background-color:#FFF!important}#cwv3_auth{border:3px solid #ccc;background:#FFF}#cwv3_auth div{padding:.25em}#cwv3_title{color:#FFF;font-weight:700;text-align:center;background:red}#cwv3_btns{overflow:hidden}#cwv3_btns div a{display:block;width:100%;text-align:center;color:#FFF;font-weight:700;text-decoration:none}#cwv3_enter{float:left;width:40%}#cwv3_enter a{background-color:#0C3}#cwv3_exit{float:right;width:40%}#cwv3_exit a{background-color:red}

56
css/sass/cwv3.scss Normal file
View File

@ -0,0 +1,56 @@
/* CSS Document */
.cwv3_box {
background: transparent;
}
/* Undocumented cBox colors */
#cboxLoadingOverlay, #cboxContent, #cboxLoadedContent {
background-color: #FFF !important;
}
#cwv3_auth {
border: 3px solid #ccc;
background: #FFF;
div{
padding: 0.25em;
}
}
#cwv3_title {
color: #FFF;
font-weight: bold;
text-align: center;
background: #f00;
}
#cwv3_btns {
overflow: hidden;
}
#cwv3_btns div a {
display: block;
width: 100%;
text-align: center;
color: #FFF;
font-weight: bold;
text-decoration: none;
}
#cwv3_enter {
float: left;
width: 40%;
}
#cwv3_enter a {
background-color: #0C3;
}
#cwv3_exit {
float: right;
width: 40%;
}
#cwv3_exit a {
background-color: #F00;
}

View File

@ -0,0 +1,91 @@
module.exports = function ( grunt ){
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON( 'package.json' ),
uglify: {
options: {
mangle: false
},
dist: {
expand: true,
cwd: 'js',
src: ['*.js','!*.min.js'],
dest: 'js',
ext: '.min.js'
}
},
jshint: {
options: {
node: false,
curly: false,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
unused: true,
boss: true,
eqnull: true,
browser: true,
globals: {
'jQuery': true,
'wp': true,
'module': true
}
},
gruntfile: {
src: 'gruntfile.js'
},
lib_test: {
src: ['js/*.js', '!js/*.min.js']
}
},
sass: {
options: {
style: 'expanded'
},
dist: {
files: {
'css/cwv3.css': 'css/sass/cwv3.scss'
}
}
},
cssmin: {
minify: {
src: 'css/cwv3.css',
dest: 'css/cwv3.min.css',
}
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
lib_test: {
files: '<%= jshint.lib_test.src %>',
tasks: ['jshint:lib_test']
},
css: {
files: 'css/**/*.scss',
tasks: ['sass', 'cssmin']
},
js: {
files: ['js/*.js', '!js/*.min.js'],
tasks: ['uglify']
}
}
});
// These plugins provide necessary tasks
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-cssmin');
// Default task
grunt.registerTask('default', ['jshint', 'sass', 'uglify', 'cssmin']);
};

View File

@ -1,12 +1,12 @@
// JavaScript Document
/* global cwv3_params */
jQuery(document).ready(function($) {
var wpdata = cwv3_params;
//console.log(wpdata);
var enter = $('#cw_enter_link');
var exit = $('#cw_exit_link');
if(wpdata.sd == true){
var cboxObj = $.colorbox(
if(wpdata.sd === true){
$.colorbox(
{
scrolling: false,
overlayClose: false,
@ -25,9 +25,12 @@ jQuery(document).ready(function($) {
);
enter.click(function(e){
if( typeof(e) !== "undefined" ){
e.preventDefault();
}
//console.log(e);
$.post(wpdata.admin_url, {action: wpdata.action, nonce: wpdata.nonce, id: wpdata.id, method: 'enter'}, function(e){
if(cwv3_params.enter == "#"){
$.post(wpdata.admin_url, {action: wpdata.action, nonce: wpdata.nonce, id: wpdata.id, method: 'enter'}, function(){
if(cwv3_params.enter === "#"){
$.colorbox.close();
}else{
window.location = wpdata.enter;
@ -36,7 +39,10 @@ jQuery(document).ready(function($) {
});
exit.click(function(e){
$.post(wpdata.admin_url, {action: wpdata.action, nonce: wpdata.nonce, id: wpdata.id, method: 'exit'}, function(e){
if( typeof(e) !== "undefined" ){
e.preventDefault();
}
$.post(wpdata.admin_url, {action: wpdata.action, nonce: wpdata.nonce, id: wpdata.id, method: 'exit'}, function(){
window.location = wpdata.exit;
});
});

1
js/cwv3.min.js vendored Normal file
View File

@ -0,0 +1 @@
jQuery(document).ready(function($){var wpdata=cwv3_params,enter=$("#cw_enter_link"),exit=$("#cw_exit_link");wpdata.sd===!0&&($.colorbox({scrolling:!1,overlayClose:!1,escKey:!1,inline:!0,href:"#cwv3_auth",initialWidth:"50%",maxWidth:"600px",loop:!1,onLoad:function(){$("#cboxClose").remove()},className:"cwv3_box",opacity:cwv3_params.opacity}),enter.click(function(e){"undefined"!=typeof e&&e.preventDefault(),$.post(wpdata.admin_url,{action:wpdata.action,nonce:wpdata.nonce,id:wpdata.id,method:"enter"},function(){"#"===cwv3_params.enter?$.colorbox.close():window.location=wpdata.enter})}),exit.click(function(e){"undefined"!=typeof e&&e.preventDefault(),$.post(wpdata.admin_url,{action:wpdata.action,nonce:wpdata.nonce,id:wpdata.id,method:"exit"},function(){window.location=wpdata.exit})}))});