Skip to content

Commit

Permalink
v1.3.3 use Mobile-Detect@2.8.22; misc other changes (see details)
Browse files Browse the repository at this point in the history
    - update dev dependencies (no impact on code)
    - add licence to source
    - add runtime version info
  • Loading branch information
hgoebl committed Jul 31, 2016
1 parent 2351f78 commit e3f661d
Show file tree
Hide file tree
Showing 11 changed files with 1,690 additions and 1,347 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
v1.3.3:
date: 2016-07-31
changes:
- use Mobile-Detect@2.8.22
- update dev dependencies (no impact on code)
- add licence to source
- add runtime version info

v1.3.2:
date: 2016-03-31
changes:
Expand Down
6 changes: 2 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ module.exports = function (grunt) {
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.repository.url%> */',

// Task configuration.
exec: {
Expand All @@ -32,7 +29,8 @@ module.exports = function (grunt) {
},
uglify: {
options: {
banner: '<%= banner %>'
preserveComments: 'some',
screwIE8: false
},
dist: {
src: 'mobile-detect.js',
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2013 Heinrich Goebl, Agenda Software GmbH & Co. KG
Copyright (c) 2013 Heinrich Goebl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ You can find out information about the device rendering your web page:
* [Mobile Grade (A, B, C)](http://jquerymobile.com/gbs/)
* specific versions (e.g. WebKit)

Current `master` branch is using detection logic from **Mobile-Detect@2.8.20**
Current `master` branch is using detection logic from **Mobile-Detect@2.8.22**

# Live Demo

Expand Down Expand Up @@ -104,9 +104,9 @@ You can easily extend it, e.g. `android`, `iphone`, etc.

## Size (bytes)

* development: 66612
* minified: 36952
* minified + gzipped: 15392 (`cat mobile-detect.min.js | gzip -9f | wc -c`)
* development: 67441
* minified: 37409
* minified + gzipped: 15615 (`cat mobile-detect.min.js | gzip -9f | wc -c`)

# Installation

Expand All @@ -120,11 +120,11 @@ You can easily extend it, e.g. `android`, `iphone`, etc.

## CDN - [jsDelivr](http://www.jsdelivr.com/#!mobile-detect.js)

<script src="//cdn.jsdelivr.net/mobile-detect.js/1.3.2/mobile-detect.min.js"></script>
<script src="//cdn.jsdelivr.net/mobile-detect.js/1.3.3/mobile-detect.min.js"></script>

## cdnjs - [cdnjs.com](https://cdnjs.com/libraries/mobile-detect)

<script src="//cdnjs.cloudflare.com/ajax/libs/mobile-detect/1.3.2/mobile-detect.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/mobile-detect/1.3.3/mobile-detect.min.js"></script>

# Extending/Modifying Behaviour

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobile-detect",
"version": "1.3.2",
"version": "1.3.3",
"description": "Device detection (phone, tablet, desktop, mobile grade, os, versions)",
"homepage": "http://hgoebl.github.io/mobile-detect.js/",
"keywords": [
Expand Down
18 changes: 16 additions & 2 deletions generate/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,19 @@ var childProcess = require('child_process'),
mote = require('mote'),
wordwrap = require('wordwrap'),
path = require('path'),
moment = require('moment'),
php = 'php'; // on windows something like 'C:\\xampp\\php\\php.exe'

function generateLicenseAndVersionInfo() {
var pkg = require(path.join(__dirname, '..', 'package.json'));
var today = moment().format('YYYY-MM-DD');
return {
licenceComment: '/*!' + pkg.name + ' v' + pkg.version + ' ' + today + '*/\n',
versionInfo: pkg.version + ' ' + today
};
}


function generateCode() {
var phpScript = path.join(__dirname, 'export-config.php');
childProcess.exec(php + ' ' + phpScript, function (error, stdout, stderr) {
Expand All @@ -20,13 +31,16 @@ function generateCode() {
var template = fs.readFileSync(path.join(__dirname, 'mobile-detect.template.js'), 'utf8'),
replaceToken = '{/*rules*/}',
tokenPos = template.indexOf(replaceToken),
jsCode;
jsCode,
licenceAndVersion = generateLicenseAndVersionInfo();

jsCode = template.substring(0, tokenPos) + stdout + template.substring(tokenPos + replaceToken.length);

jsCode = addComments(jsCode, stdout);

jsCode = '// THIS FILE IS GENERATED - DO NOT EDIT!\n' + jsCode;
jsCode = '// THIS FILE IS GENERATED - DO NOT EDIT!\n' + licenceAndVersion.licenceComment + jsCode;

jsCode = jsCode.replace(/MOBILE_DETECT_VERSION/, licenceAndVersion.versionInfo);

fs.writeFileSync(path.join(__dirname, '..', 'mobile-detect.js'), jsCode, 'utf-8');
});
Expand Down
4 changes: 3 additions & 1 deletion generate/mobile-detect.template.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*global module:false, define:false*/

/*!@license Copyright 2013, Heinrich Goebl, License: MIT, see https://github.com/hgoebl/mobile-detect.js*/
(function (define, undefined) {
define(function () {
'use strict';
Expand Down Expand Up @@ -656,6 +656,8 @@ define(function () {

// should not be replaced by a completely new object - just overwrite existing methods
MobileDetect._impl = impl;

MobileDetect.version = 'MOBILE_DETECT_VERSION';

return MobileDetect;
}); // end of call of define()
Expand Down
101 changes: 57 additions & 44 deletions mobile-detect.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions mobile-detect.min.js

Large diffs are not rendered by default.

95 changes: 48 additions & 47 deletions package.json
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,49 +1,50 @@
{
"name": "mobile-detect",
"version": "1.3.2",
"description": "Device detection (phone, tablet, desktop, mobile grade, os, versions)",
"main": "mobile-detect.js",
"scripts": {
"test": "grunt jasmine_node"
},
"repository": {
"type": "git",
"url": "https://github.com/hgoebl/mobile-detect.js"
},
"homepage": "http://hgoebl.github.io/mobile-detect.js/",
"keywords": [
"useragent",
"mobile",
"phone",
"tablet",
"detect",
"device",
"browser",
"version",
"mobilegrade",
"sniff"
],
"author": {
"name": "Heinrich Goebl",
"email": "hgoebl@goebl.com",
"url": "http://www.goebl.com/"
},
"license": "MIT",
"readmeFilename": "README.md",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.1.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-watch": "~0.3.1",
"grunt-jasmine-node": "~0.1.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-jsdoc": "~0.4.0",
"grunt-exec": "~0.4.2",
"uglify-js": "~2.4.15",
"jshint": "0.9.1",
"mote": "0.2.0",
"wordwrap": "0.0.2"
}
"name": "mobile-detect",
"version": "1.3.3",
"description": "Device detection (phone, tablet, desktop, mobile grade, os, versions)",
"main": "mobile-detect.js",
"scripts": {
"test": "grunt jasmine_node"
},
"repository": {
"type": "git",
"url": "https://github.com/hgoebl/mobile-detect.js"
},
"homepage": "http://hgoebl.github.io/mobile-detect.js/",
"keywords": [
"useragent",
"mobile",
"phone",
"tablet",
"detect",
"device",
"browser",
"version",
"mobilegrade",
"sniff"
],
"author": {
"name": "Heinrich Goebl",
"email": "hgoebl@goebl.com",
"url": "http://www.goebl.com/"
},
"license": "MIT",
"readmeFilename": "README.md",
"dependencies": {},
"devDependencies": {
"grunt": "~1.0.1",
"grunt-contrib-concat": "~1.0.1",
"grunt-contrib-copy": "~1.0.0",
"grunt-contrib-jshint": "~1.0.0",
"grunt-contrib-uglify": "~2.0.0",
"grunt-contrib-watch": "~1.0.0",
"grunt-exec": "~1.0.0",
"grunt-jasmine-node": "~0.3.1",
"grunt-jsdoc": "~2.1.0",
"jshint": "2.9.2",
"moment": "^2.14.1",
"mote": "0.2.0",
"uglify-js": "~2.7.0",
"wordwrap": "1.0.0"
}
}
Loading

0 comments on commit e3f661d

Please sign in to comment.