Skip to content

Commit

Permalink
Merge pull request #4 from pure-js/to-pure-js
Browse files Browse the repository at this point in the history
To pure js
  • Loading branch information
pure-js authored Nov 25, 2016
2 parents 0297864 + 98e3b93 commit 950c29e
Show file tree
Hide file tree
Showing 12 changed files with 230 additions and 212 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ bower_components

# Build
build

# OSX
.DS_store
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Check browser
Check browser version and show pop-up if version is less then recommended

bower i
npm i
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"description": "script to check browser version",
"main": "src/check-browser.js",
"authors": [
"IamEmpty"
"pure-js"
],
"license": "MIT",
"keywords": [
"js"
],
"homepage": "https://github.com/iamempty/check-browser",
"homepage": "https://github.com/pure-js/check-browser",
"ignore": [
"**/.*",
"node_modules",
Expand Down
49 changes: 0 additions & 49 deletions demo/demo.html

This file was deleted.

101 changes: 48 additions & 53 deletions demo/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ html(lang='en')
link(rel='stylesheet', href='old-browser.css')
//- SyntaxHighlighter style
link(rel='stylesheet', href='prism.css')
//- Add jquery
script(src='https://code.jquery.com/jquery-1.11.0.min.js')
//- Latest compiled and minified Bootstrap JavaScript
script(src='https://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js')
//- Add plugin Check browser
script(src='check-browser.js')
//- Syntax highlighter Prism js
script(src='prism.js')
//- Own main javascript file
script(src='main.js')
body(data-spy='scroll', data-target='#bs-example-navbar-collapse-1', data-offset='170')
header.header
nav.navbar.navbar-default.navbar-fixed-top(role='navigation')
Expand Down Expand Up @@ -47,71 +37,63 @@ html(lang='en')
h1#home The check browser version plugin
p Latest version is 1.0.0
p You can use default view of this plugin look like so (See under) or create himself warning block
.row
.col-md-12
.old-browser-warning
.old-browser-warning__left-side
h3.text-primary.h3 Warning!
p.old-browser-warning__text You use the oldest version of a browser. It may be a reason of incorrect work and view of a website.
p.old-browser-warning__text For comfortable work, please download latest version of a browser convenient for you from official website.
p.old-browser-warning__text
| Please read our
a.old-browser-warning__link(href='#') documentation
| .
.old-browser-warning__right-side
a.old-browser-warning__img-link.browser-sprite.browser-chrome(href='https://www.google.com/intl/ru/chrome/browser/', target='_blank', title='Chrome')
a.old-browser-warning__img-link.browser-sprite.browser-firefox(href='http://www.mozilla.org/ru/firefox/new/', target='_blank', title='Firefox')
a.old-browser-warning__img-link.browser-sprite.browser-ie(href='http://windows.microsoft.com/ru-ru/internet-explorer/download-ie', target='_blank', title='Internet Explorer')
a.old-browser-warning__img-link.browser-sprite.browser-opera(href='http://www.opera.com/ru', target='_blank', title='Opera')
i#close-old-browser-warning.icon-remove(title='Close')
.old-browser-warning
.old-browser-warning__left-side
h3.text-primary.h3 Warning!
p.old-browser-warning__text You use the oldest version of a browser. It may be a reason of incorrect work and view of a website.
p.old-browser-warning__text For comfortable work, please download latest version of a browser convenient for you from official website.
p.old-browser-warning__text
| Please read our
a.old-browser-warning__link(href='#') documentation
| .
.old-browser-warning__right-side
a.old-browser-warning__img-link.browser-sprite.browser-chrome(href='https://www.google.com/intl/ru/chrome/browser/', target='_blank', title='Chrome')
a.old-browser-warning__img-link.browser-sprite.browser-firefox(href='http://www.mozilla.org/ru/firefox/new/', target='_blank', title='Firefox')
a.old-browser-warning__img-link.browser-sprite.browser-ie(href='http://windows.microsoft.com/ru-ru/internet-explorer/download-ie', target='_blank', title='Internet Explorer')
a.old-browser-warning__img-link.browser-sprite.browser-opera(href='http://www.opera.com/ru', target='_blank', title='Opera')
i#close-old-browser-warning.icon-remove(title='Close')
.row
.col-md-12
p For begin you need check - you use jquery or not use? If you not add jquery plugin - you need do it
p And inicialize plugin
pre
code.language-javascript.
$(document).ready(function () {
$('body').checkBrowser();
});

checkBrowser();
p All supported params:
pre
code.language-javascript.
$(document).ready(function () {
$('body').checkBrowser({
once: 'No',
warningBoxName: '.old-browser-warning',
closeBtnName: '#close-old-browser-warning',
duration: 1200,
easing: 'swing',

browsers: {
Firefox: 27,
Chrome: 30,
Opera: 15,
IE: 10
}
});
checkBrowser({
once: false,
warningEl: '.old-browser-warning',
closeBtnName: '#close-old-browser-warning',
duration: 1200,
easing: 'swing',
browsers: {
Firefox: 27,
Chrome: 30,
Opera: 15,
IE: 10
}
});
p In this option you can change amount of show
pre
code.language-javascript.
$('body').checkBrowser({
once: 'No'
checkBrowser({
once: false
});
pre
code.language-javascript.
$('body').checkBrowser({
warningBoxName: '.old-browser-warning'
checkBrowser({
warningEl: '.old-browser-warning'
});
pre
code.language-javascript.
$('body').checkBrowser({
checkBrowser({
closeBtnName: '#close-old-browser-warning'
});
pre
code.language-javascript.
$('body').checkBrowser({
checkBrowser({
duration: 1200
});
pre
Expand All @@ -121,11 +103,24 @@ html(lang='en')
});
pre
code.language-javascript.
$('body').checkBrowser({
checkBrowser({
browsers: {
Firefox: 27,
Chrome: 30,
Opera: 15,
IE: 10
}
});
//- Add plugin Check browser
script(src='check-browser.js')
//- Syntax highlighter Prism js
script(src='prism.js')
//- Own main javascript file
script.
checkBrowser({
once: true,
duration: 1000,
browsers: {
Chrome: 57
}
});
9 changes: 0 additions & 9 deletions demo/js/main.js

This file was deleted.

19 changes: 19 additions & 0 deletions gulp/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
paths: {
pug: 'demo/index.pug',
pugWatch: [
'demo/index.pug',
],
styl: [
'stylesheets/old-browser.styl'
],
stylWatch: [
'src/blocks/**/*.styl'
],
copy: ['bower_components/prism/prism.js', 'bower_components/prism/themes/prism.css', 'src/check-browser.js'],
build: 'build/'
},
names: {
css: 'app.min.css'
}
};
28 changes: 28 additions & 0 deletions gulp/tasks/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const gulp = require('gulp'),
config = require('../config'),
plugins = require('gulp-load-plugins')();

const build = gulp.parallel(html, css, copy);

module.exports = build;

function html() {
return gulp.src(config.paths.pug)
.pipe(plugins.pug({
pretty: true
}))
.pipe(gulp.dest(config.paths.build));
}

function css() {
return gulp.src(config.paths.styl)
.pipe(plugins.stylus({
'include css': true
}))
.pipe(gulp.dest(config.paths.build));
}

function copy() {
return gulp.src(config.paths.copy)
.pipe(gulp.dest(config.paths.build));
}
5 changes: 5 additions & 0 deletions gulp/tasks/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = require('require-dir')('.', {
camelcase: true,
recurse: true
}
);
25 changes: 25 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const gulp = require('gulp'),
del = require('del'),
config = require('./gulp/config'),
tasks = require('./gulp/tasks'),
plugins = require('gulp-load-plugins')();

gulp.task('build', tasks.build);

const clean = () => del([config.paths.build]);

exports.clean = clean;

function watch() {
gulp.watch(config.paths.stylusWatch, tasks.build);
gulp.watch(config.paths.pugWatch, tasks.build);
}

// gulp.task('deploy', () =>
// gulp.src(paths.dist + '**/*')
// .pipe(plugins.ghPages())
// );

// The default task (called when you run `gulp` from cli)
const dev = gulp.parallel(tasks.build, watch);
gulp.task('default', dev);
29 changes: 14 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,32 @@
"name": "check-browser",
"version": "0.0.1",
"description": "script to check browser version",
"main": "README.md",
"main": "src/check-browser.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"pug": "pug demo --out build",
"stylus": "stylus stylesheets/old-browser.styl -o build",
"copy1": "cp bower_components/prism/prism.js build",
"copy2": "cp bower_components/prism/themes/prism.css build",
"copy3": "cp src/check-browser.js build",
"copy4": "cp demo/js/main.js build",
"build": "npm run pug && npm run stylus && npm run copy1 && npm run copy2 && npm run copy3 && npm run copy4"
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/IamEmpty/check-browser.git"
"url": "git+https://github.com/pure-js/check-browser.git"
},
"keywords": [
"js"
],
"author": "IamEmpty",
"author": "pure-js",
"license": "MIT",
"bugs": {
"url": "https://github.com/IamEmpty/check-browser/issues"
"url": "https://github.com/pure-js/check-browser/issues"
},
"homepage": "https://github.com/IamEmpty/check-browser#readme",
"homepage": "https://github.com/pure-js/check-browser#readme",
"devDependencies": {
"del": "^2.2.2",
"gulp-load-plugins": "^1.4.0",
"jshint": "^2.8.0",
"pug": "^2.0.0-beta2",
"stylus": "^0.54.5"
"require-dir": "^0.3.1"
},
"dependencies": {
"gulp": "github:gulpjs/gulp#4.0",
"gulp-pug": "^3.1.0",
"gulp-stylus": "^2.6.0"
}
}
Loading

0 comments on commit 950c29e

Please sign in to comment.