bring in Bookcision project from bitbucket/mercurial (https://bitbucket.org/altano/bookcision/overview) into git/github
16
.gitignore
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
syntax: glob
|
||||
re:^bookcision\.sublime-workspace$
|
||||
re:^aws\.json$
|
||||
re:^dest/
|
||||
re:^node_modules/
|
||||
re:^node_modules.bak/
|
||||
re:^build/
|
||||
re:^src\excisor\npm-debug\.log$
|
||||
re:^azure.json$
|
||||
re:^rollbar.json$
|
||||
EnableCorsInAzure/EnableCorsConsole/bin/
|
||||
EnableCorsInAzure/EnableCorsConsole/obj/
|
||||
EnableCorsInAzure/packages/
|
||||
EnableCorsInAzure\EnableCorsConsole\azure.config
|
||||
*.suo
|
||||
obj/
|
||||
6
.hg_archival.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
repo: ea91f34481ec3f5b51eb54e547efa8dfbdcff724
|
||||
node: 2ea168564ad8c573f04a8a24d4dddeaaf50cf473
|
||||
branch: default
|
||||
latesttag: v4.0.4-0
|
||||
latesttagdistance: 4
|
||||
changessincelatesttag: 4
|
||||
16
.hgignore
Normal file
@@ -0,0 +1,16 @@
|
||||
syntax: glob
|
||||
re:^bookcision\.sublime-workspace$
|
||||
re:^aws\.json$
|
||||
re:^dest/
|
||||
re:^node_modules/
|
||||
re:^node_modules.bak/
|
||||
re:^build/
|
||||
re:^src\excisor\npm-debug\.log$
|
||||
re:^azure.json$
|
||||
re:^rollbar.json$
|
||||
EnableCorsInAzure/EnableCorsConsole/bin/
|
||||
EnableCorsInAzure/EnableCorsConsole/obj/
|
||||
EnableCorsInAzure/packages/
|
||||
EnableCorsInAzure\EnableCorsConsole\azure.config
|
||||
*.suo
|
||||
obj/
|
||||
42
.hgtags
Normal file
@@ -0,0 +1,42 @@
|
||||
04a853b84fdeffda8ae3f093ec6622922952a3a0 v1.0.3
|
||||
68c16dd04e18879f6c50f326f173a4e225ded272 v1.0.4
|
||||
b0b80c0a5b478666d4d4c9982605be95fa34153c v1.0.5
|
||||
460148c5525f484b172bde6066545ebcca2f2cff v1.0.6
|
||||
7a39c963d87f63b008f457a8cd3eb91334741840 v1.0.7
|
||||
33eae47f9ff364cd7ec5eb6923e792c69e051593 1.0.8
|
||||
33eae47f9ff364cd7ec5eb6923e792c69e051593 1.0.8
|
||||
0000000000000000000000000000000000000000 1.0.8
|
||||
f910d45eeebdeb3b56efae56cb64656feb8acfc6 v1.0.8
|
||||
f797e9074045a2267d18b092b14b2a328ab5d823 v1.1.0
|
||||
5aaff8c978487f4f7161070a8db4fd7e789c3a8f v1.1.1
|
||||
e5f37272b8583af5e679f48db27922697d0c3ddf v1.1.2
|
||||
7649f175b3977b9eea5dd3f769b530c968fc2585 v2.0.0
|
||||
331aceda9da377c17c98747fc251b44a4b6c6d09 v2.0.1
|
||||
33387b493afae05fc8d93d86c56303e4b6e0316c v2.0.1-0
|
||||
be87745aa0c917a1a062cafeed2c05939425618e v2.0.2
|
||||
b1ef48e2323c71588383070bc18116f7ad3d7ddc v2.0.3
|
||||
3f1e4c40155b469f330a9e77bc3719d17c0f691b v2.0.4
|
||||
b849bc2c56dd7327e1ea3b69a169ee6f6cb3ea9f v2.0.4-0
|
||||
2a0c89f2b2f2aeb05d7cd72a5b94ef5c8f72f96d v2.0.4-1
|
||||
dc9350505092724ed119eb53c6f3a864f0c4359b v2.0.5
|
||||
fc8d07d92ae43da6976ac9528bbe21bbca2581f2 v2.0.6
|
||||
22ebd511a34a526e936a29f74d310f435bee81bb v2.0.7
|
||||
eb8c744e72fb5127c9042ac3e2167e062e099fb8 v2.0.8
|
||||
e97702b06fb6ff1c9cb17884e6e0fd1329005881 v2.0.8-0
|
||||
a4d20379988c3a08bcc15b87c8cdbb9ca4a730af v2.0.9
|
||||
9e07ff76b767986a641fc7c201e60d6a264aa13d v2.1.0
|
||||
31581908ba8b4c7f226bd648edb2f4a528120a10 v2.1.1-0
|
||||
d913dd1a191aedf00f6f71aa54e55f4d9ab572f8 v2.1.1-1
|
||||
ca40e5fd202e749eb92a0bfebdac5019b1798b66 v2.1.1-2
|
||||
b32c6dc62faebd6c4cb7dd1274b2f9484f874a39 v2.2.0
|
||||
96b4f01f150c40f8f68c6d155e79e9eae8e3bc4b v3.0.1-0
|
||||
4889f71490d8e87784d0e712fa81e1faed3bdc2b v3.0.1-1
|
||||
a2311125698325a2e9d265b0f06b729d1d9de8a9 v3.0.1-2
|
||||
53b7b26355148a2178c4f1218b8f2949a4c78650 v3.0.1-3
|
||||
95124f75f6f2d2a2342be416bdb82ac38a6fa0f7 v3.0.1-4
|
||||
d81ef20fb66fe8a63a7a6fe506ac02a27cd97f08 v3.0.1-5
|
||||
1d94d73d2fd3b00c76733e73d5c9a36a17b2f8c5 v4.0.0
|
||||
c57a78b4dd18780532c060dfdb7d08f5ee0b0a51 v4.0.1
|
||||
9f79ec42bc07f9f90c7e730d27a4f93e757f4155 v4.0.2
|
||||
c3a1d9727b13f9dd929c29107eaa2e0e3dbaaa7e v4.0.3
|
||||
8953cfbc1de4102f9f7f6511caed81160c681691 v4.0.4-0
|
||||
4
.prettierrc
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"trailingComma": "es5",
|
||||
"singleQuote": true
|
||||
}
|
||||
11
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"files.exclude": {
|
||||
"**/.git": true,
|
||||
"**/.svn": true,
|
||||
"**/.hg": true,
|
||||
"**/.DS_Store": true,
|
||||
"node_modules/**/*": true
|
||||
},
|
||||
"prettier.singleQuote": true
|
||||
}
|
||||
9
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "0.1.0",
|
||||
"command": "grunt",
|
||||
"isShellCommand": true,
|
||||
"args": ["--no-color"],
|
||||
"showOutput": "always"
|
||||
}
|
||||
22
EnableCorsInAzure/EnableCorsConsole.sln
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.30110.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnableCorsConsole", "EnableCorsConsole\EnableCorsConsole.csproj", "{03303625-E95E-446C-98EE-9D7651799C33}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{03303625-E95E-446C-98EE-9D7651799C33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{03303625-E95E-446C-98EE-9D7651799C33}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{03303625-E95E-446C-98EE-9D7651799C33}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{03303625-E95E-446C-98EE-9D7651799C33}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
25
EnableCorsInAzure/EnableCorsConsole/App.config
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.6.1.0" newVersion="5.6.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.6.1.0" newVersion="5.6.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.6.1.0" newVersion="5.6.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
<appSettings configSource="azure.config" />
|
||||
|
||||
</configuration>
|
||||
93
EnableCorsInAzure/EnableCorsConsole/EnableCorsConsole.csproj
Normal file
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{03303625-E95E-446C-98EE-9D7651799C33}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>EnableCorsConsole</RootNamespace>
|
||||
<AssemblyName>EnableCorsConsole</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Data.Edm, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.Data.Edm.5.6.1\lib\net40\Microsoft.Data.Edm.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Data.OData, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.Data.OData.5.6.1\lib\net40\Microsoft.Data.OData.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Data.Services.Client, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.Data.Services.Client.5.6.1\lib\net40\Microsoft.Data.Services.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.WindowsAzure.Configuration">
|
||||
<HintPath>..\packages\Microsoft.WindowsAzure.ConfigurationManager.1.8.0.0\lib\net35-full\Microsoft.WindowsAzure.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.WindowsAzure.Storage">
|
||||
<HintPath>..\packages\WindowsAzure.Storage.3.1.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.Services.Client" />
|
||||
<Reference Include="System.Spatial, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\System.Spatial.5.6.1\lib\net40\System.Spatial.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="azure.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="azure.example.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Service References\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
46
EnableCorsInAzure/EnableCorsConsole/Program.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using Microsoft.WindowsAzure.Storage.Auth;
|
||||
using Microsoft.WindowsAzure.Storage.Blob;
|
||||
using Microsoft.WindowsAzure.Storage.Shared.Protocol;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace ConfigureBlobService
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
||||
Console.WriteLine("Configuring CORS on the Windows Azure BLOB service");
|
||||
SetsServiceProperties(new Uri(appSettings["StorageUri"]), appSettings["AccountName"], appSettings["AccountKey"]);
|
||||
}
|
||||
|
||||
static void SetsServiceProperties(Uri blobEndpoint, string accountName, string accountKey)
|
||||
{
|
||||
CloudBlobClient client =
|
||||
new CloudBlobClient(blobEndpoint, new StorageCredentials(accountName, accountKey));
|
||||
|
||||
// Set the service properties.
|
||||
ServiceProperties sp = client.GetServiceProperties();
|
||||
sp.DefaultServiceVersion = "2013-08-15";
|
||||
|
||||
CorsRule cr = new CorsRule();
|
||||
cr.AllowedHeaders.Add("*");
|
||||
cr.AllowedMethods = CorsHttpMethods.Get;
|
||||
cr.AllowedOrigins.Add("*");
|
||||
//cr.AllowedOrigins.Add("http://kindle.amazon.com");
|
||||
//cr.AllowedOrigins.Add("https://kindle.amazon.com");
|
||||
//cr.AllowedOrigins.Add("http://read.amazon.com");
|
||||
//cr.AllowedOrigins.Add("https://read.amazon.com");
|
||||
cr.MaxAgeInSeconds = 5;
|
||||
sp.Cors.CorsRules.Clear();
|
||||
sp.Cors.CorsRules.Add(cr);
|
||||
|
||||
client.SetServiceProperties(sp);
|
||||
|
||||
ServiceProperties finalSp = client.GetServiceProperties();
|
||||
Console.WriteLine(finalSp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("EnableCorsConsole")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("EnableCorsConsole")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("d8f0fd56-7672-42e6-b572-242909bc5c00")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
5
EnableCorsInAzure/EnableCorsConsole/azure.example.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<appSettings>
|
||||
<add key="StorageUri" value="http://norbauercdn.blob.core.windows.net" />
|
||||
<add key="AccountName" value="XXXXXX" />
|
||||
<add key="AccountKey" value="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" />
|
||||
</appSettings>
|
||||
10
EnableCorsInAzure/EnableCorsConsole/packages.config
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Data.Edm" version="5.6.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Data.OData" version="5.6.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Data.Services.Client" version="5.6.1" targetFramework="net45" />
|
||||
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="1.8.0.0" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="5.0.8" targetFramework="net45" />
|
||||
<package id="System.Spatial" version="5.6.1" targetFramework="net45" />
|
||||
<package id="WindowsAzure.Storage" version="3.1.0.0" targetFramework="net45" />
|
||||
</packages>
|
||||
382
Gruntfile.js
Normal file
@@ -0,0 +1,382 @@
|
||||
module.exports = function(grunt) {
|
||||
'use strict';
|
||||
// Load all npm packages defined in package.json that start with "grunt-"
|
||||
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
|
||||
require('matchdep').filter('grunt-*').forEach(grunt.loadNpmTasks);
|
||||
|
||||
var path = require('path');
|
||||
var changeCase = require('change-case');
|
||||
var webpack = require('webpack');
|
||||
var lrSnippet = require('grunt-contrib-livereload/lib/utils')
|
||||
.livereloadSnippet;
|
||||
var LIVERELOAD_PORT = 9001;
|
||||
|
||||
grunt.loadTasks('tasks');
|
||||
|
||||
var folderMount = function folderMount(connect, point) {
|
||||
return connect.static(path.resolve(point));
|
||||
};
|
||||
|
||||
// Read in package.json and layer on some grunt-specific properties
|
||||
var azure = grunt.file.readJSON('azure.json');
|
||||
var rollbar = grunt.file.readJSON('rollbar.json');
|
||||
|
||||
var getBuiltFilesArray = function(type, dest) {
|
||||
var srcPattern = type === 'js' ? '**/*.js' : '**/*!(.js)';
|
||||
var destination = dest === 'latest' ? 'latest' : '<%= pkg.version %>';
|
||||
return [
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'dest',
|
||||
filter: 'isFile',
|
||||
src: srcPattern,
|
||||
dest: destination + '/'
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
grunt.initConfig({
|
||||
asciify: {
|
||||
options: {
|
||||
font: 'trek',
|
||||
log: true
|
||||
},
|
||||
banner: {
|
||||
get text() {
|
||||
return changeCase.upperCase(grunt.config.get('pkg.name'));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
meta: {
|
||||
banner:
|
||||
'' +
|
||||
'/*!\n\n' +
|
||||
' <%= asciify_banner %>' +
|
||||
' * <%= pkg.title %> v<%= pkg.version %> - <%= pkg.tagline %>\n' +
|
||||
' * <%= pkg.homepage %> \n' +
|
||||
' * Copyright (c) <%= grunt.template.today("yyyy") %> ' +
|
||||
'<%= pkg.author %>\n' +
|
||||
' * MIT Licensed\n' +
|
||||
' */\n'
|
||||
},
|
||||
|
||||
webpack: {
|
||||
options: {
|
||||
context: __dirname,
|
||||
|
||||
entry: './src/index.js',
|
||||
|
||||
target: 'web',
|
||||
|
||||
stats: {
|
||||
// Configure the console output
|
||||
// colors: false,
|
||||
// modules: true,
|
||||
// reasons: true /*@TODO Before release, comb the debug.js file using this to make sure everything included is desired*/
|
||||
},
|
||||
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.json$/, loader: 'json-loader' },
|
||||
{ test: /\.css$/, loader: 'style-loader!css-loader' },
|
||||
{ test: /\.less$/, loader: 'style-loader!css-loader!less-loader' },
|
||||
{ test: /\.jade$/, loader: 'jade-loader' },
|
||||
{ test: /\.handlebars$/, loader: 'handlebars-loader' }
|
||||
// { test: /\.png$/, loader: "url-loader?limit=10000&minetype=image/png" },
|
||||
// { test: /\.jpg$/, loader: "url-loader?limit=10000&minetype=image/jpg" },
|
||||
// { test: /\.gif$/, loader: "url-loader?limit=10000&minetype=image/gif" },
|
||||
// { test: /\.woff$/, loader: "url-loader?limit=10000&minetype=application/font-woff" }
|
||||
]
|
||||
},
|
||||
|
||||
// Fail grunt task on webpacking error (https://github.com/webpack/webpack/issues/81)
|
||||
failOnError: true,
|
||||
|
||||
resolve: {
|
||||
root: path.join(__dirname, 'src'),
|
||||
modulesDirectories: [
|
||||
'web_modules',
|
||||
'node_modules',
|
||||
'src/lib/handlebars-helpers'
|
||||
],
|
||||
fallback: __dirname
|
||||
},
|
||||
|
||||
options: {
|
||||
debug: false
|
||||
}
|
||||
},
|
||||
test: {
|
||||
entry: './test/index.js',
|
||||
target: 'node',
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
DEBUG: false,
|
||||
TEST: true
|
||||
}),
|
||||
new webpack.ProvidePlugin({
|
||||
sinon: 'sinon',
|
||||
should: 'should',
|
||||
assert: 'assert'
|
||||
})
|
||||
],
|
||||
output: {
|
||||
path: path.join(__dirname, 'dest'),
|
||||
filename: '<%= pkg.moduleName %>.test.js'
|
||||
},
|
||||
resolve: {
|
||||
alias: { 'lib/ui/css$': 'lib/stub' },
|
||||
extensions: ['', '.node', '.er.js', '.js', '.json']
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /sinon.js$/, loader: 'imports?define=>false' }
|
||||
// { test: /\.json$/, loader: "json" }
|
||||
]
|
||||
// ,postLoaders: [{
|
||||
// test: /src\\.*\.js$/, // @TODO me thinks webpack needs a test that is path-friendly rather than a filename regex
|
||||
// exclude: [
|
||||
// "node_modules.chai",
|
||||
// "node_modules.coverjs-loader",
|
||||
// "node_modules.webpack.buildin"
|
||||
// ],
|
||||
// loader: "coverjs-loader"
|
||||
// }]
|
||||
}
|
||||
},
|
||||
debug: {
|
||||
devtool: 'source-map',
|
||||
options: { debug: true },
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
DEBUG: true,
|
||||
TEST: false
|
||||
}),
|
||||
new webpack.BannerPlugin('<%= meta.banner %>', { raw: true }),
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
// Gets passed through to UglifyJS, allows us to enable conditional compilation (and dead code removal for DEBUG-gated code)
|
||||
compressor: {
|
||||
drop_debugger: false,
|
||||
warnings: false,
|
||||
unused: false
|
||||
}, // @TODO turn warnings back on
|
||||
beautify: true,
|
||||
comments: 'all',
|
||||
mangle: false
|
||||
})
|
||||
],
|
||||
output: {
|
||||
path: path.join(__dirname, 'dest'),
|
||||
filename: '<%= pkg.moduleName %>.debug.js'
|
||||
}
|
||||
},
|
||||
release: {
|
||||
options: { debug: false },
|
||||
devtool: 'source-map',
|
||||
/* @TODO profile: true, */
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
DEBUG: false,
|
||||
TEST: false
|
||||
}),
|
||||
new webpack.BannerPlugin('<%= meta.banner %>', { raw: true }),
|
||||
new webpack.optimize.DedupePlugin(),
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
// Gets passed through to UglifyJS, allows us to enable conditional compilation (and dead code removal for DEBUG-gated code)
|
||||
compressor: { warnings: false } // @TODO turn warnings back on
|
||||
})
|
||||
],
|
||||
output: {
|
||||
path: path.join(__dirname, 'dest'),
|
||||
filename: '<%= pkg.moduleName %>.js'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
jade: {
|
||||
options: {
|
||||
pretty: true, // Don't bother compressing the release html. This Grunt task doesn't handle any of the internal jade templates, which we do compress. webpack's jade-loader takes care of those.
|
||||
data: {
|
||||
get pkg() {
|
||||
return grunt.config.get('pkg');
|
||||
}
|
||||
}
|
||||
},
|
||||
'bookmarklet-debug': {
|
||||
options: {
|
||||
data: {
|
||||
get pkg() {
|
||||
return grunt.config.get('pkg');
|
||||
},
|
||||
debug: true
|
||||
}
|
||||
},
|
||||
files: {
|
||||
'dest/bookmarklet.debug.html': ['src/bookmarklet.jade'],
|
||||
'dest/test.html': ['test/test.jade']
|
||||
}
|
||||
},
|
||||
'bookmarklet-release': {
|
||||
files: {
|
||||
'dest/bookmarklet.html': ['src/bookmarklet.jade']
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
uglify: {
|
||||
options: {
|
||||
compress: { dead_code: true }
|
||||
},
|
||||
'bookmarklet-debug': {
|
||||
options: {
|
||||
compress: { global_defs: { DEBUG: true } }, // enables condition code compilation
|
||||
beautify: true,
|
||||
comments: 'all',
|
||||
mangle: false
|
||||
},
|
||||
files: {
|
||||
'dest/bookmarklet.debug.js': ['src/bookmarklet.js']
|
||||
}
|
||||
},
|
||||
'bookmarklet-release': {
|
||||
options: {
|
||||
compress: { global_defs: { DEBUG: false } },
|
||||
comments: 'some'
|
||||
},
|
||||
files: {
|
||||
'dest/bookmarklet.js': ['src/bookmarklet.js']
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
simplemocha: {
|
||||
options: {
|
||||
reporter: 'spec',
|
||||
globals: ['should']
|
||||
},
|
||||
|
||||
all: {
|
||||
src: path.join(__dirname, 'dest', '<%= pkg.moduleName %>.test.js')
|
||||
}
|
||||
},
|
||||
|
||||
// Tasks to deploy to CDN
|
||||
env: {
|
||||
azure: {
|
||||
src: 'azure.json'
|
||||
}
|
||||
},
|
||||
|
||||
azureblob: {
|
||||
options: {
|
||||
containerName: 'bookcision',
|
||||
containerOptions: { publicAccessLevel: 'Blob' },
|
||||
metadata: { cacheControl: 'public, max-age=86400' } // 1 day
|
||||
// ,copySimulation: true
|
||||
},
|
||||
'upload-this-version-js': {
|
||||
options: { gzip: true },
|
||||
files: getBuiltFilesArray('js', 'version')
|
||||
},
|
||||
'upload-this-version-non-js': {
|
||||
files: getBuiltFilesArray('non-js', 'version')
|
||||
},
|
||||
'go-live-with-this-version-js': {
|
||||
options: { gzip: true },
|
||||
files: getBuiltFilesArray('js', 'latest')
|
||||
},
|
||||
'go-live-with-this-version-non-js': {
|
||||
files: getBuiltFilesArray('non-js', 'latest')
|
||||
}
|
||||
},
|
||||
|
||||
copy: {
|
||||
zeroclipboard: {
|
||||
src: 'node_modules/zeroclipboard/ZeroClipboard.swf',
|
||||
dest: 'dest/ZeroClipboard.swf'
|
||||
}
|
||||
},
|
||||
|
||||
'rollbar-sourcemap-download': {
|
||||
options: {
|
||||
access_token: rollbar.server_access_token,
|
||||
version: '<%= pkg.version %>'
|
||||
},
|
||||
version:
|
||||
'https://' +
|
||||
azure.AZURE_STORAGE_ACCOUNT +
|
||||
'.blob.core.windows.net/bookcision/<%= pkg.version %>/<%= pkg.moduleName %>.js',
|
||||
latest:
|
||||
'https://' +
|
||||
azure.AZURE_STORAGE_ACCOUNT +
|
||||
'.blob.core.windows.net/bookcision/latest/<%= pkg.moduleName %>.js'
|
||||
},
|
||||
|
||||
hg_release: {
|
||||
options: {
|
||||
commit: 'v<%= version %>',
|
||||
tag: 'v<%= version %>'
|
||||
}
|
||||
},
|
||||
|
||||
// livereload server
|
||||
connect: {
|
||||
livereload: {
|
||||
options: {
|
||||
port: LIVERELOAD_PORT,
|
||||
middleware: function(connect, options) {
|
||||
return [lrSnippet, folderMount(connect, '.')];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// livereload requires regarde (vs. grunt-contrib-watch)
|
||||
regarde: {
|
||||
// Watch for changes in the source and rebuild the final packages
|
||||
build: {
|
||||
files: ['src/**/*', 'test/**/*', 'build/**/*'],
|
||||
tasks: ['build']
|
||||
},
|
||||
// Watch for changes to the final packages and deploy them to the browser (if livereload is running)
|
||||
reload: {
|
||||
files: 'dest/**/*',
|
||||
tasks: ['livereload']
|
||||
}
|
||||
},
|
||||
|
||||
open: {
|
||||
dev: {
|
||||
path: 'http://localhost:' + LIVERELOAD_PORT + '/dest/test.html'
|
||||
}
|
||||
},
|
||||
|
||||
clean: {
|
||||
all: ['dest', 'build']
|
||||
}
|
||||
}); // end initConfig()
|
||||
|
||||
grunt.registerTask('readPackageJSON', function() {
|
||||
var pkg = grunt.file.readJSON('package.json');
|
||||
pkg.title = changeCase.titleCase(pkg.name);
|
||||
pkg.moduleName = changeCase.camelCase(pkg.name);
|
||||
|
||||
grunt.config.set('pkg', pkg);
|
||||
});
|
||||
grunt.task.run('readPackageJSON');
|
||||
|
||||
grunt.registerTask('test', ['webpack:test', 'simplemocha']);
|
||||
|
||||
grunt.registerTask('watch', ['regarde']);
|
||||
grunt.registerTask('generate-banner', ['asciify']);
|
||||
grunt.registerTask('lr', [
|
||||
'build',
|
||||
'livereload-start',
|
||||
'connect',
|
||||
'open',
|
||||
'watch'
|
||||
]);
|
||||
|
||||
grunt.registerTask('default', ['test']);
|
||||
};
|
||||
46
README.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# Bookcision
|
||||
|
||||
http://www.norbauer.com/bookcision/
|
||||
|
||||
http://twitter.com/NorbauerApps
|
||||
|
||||
When highlights and notes are created on any Kindle device, they are synced up to Amazon's cloud. These are then visible at read.amazon.com, but there is no reason to believe that Amazon will continue to provide this service forever, and our ability to work with text in that hosted browser-based environment is limited. This is a bookmarklet that permits one to excise notes/highlights from read.amazon.com. It yields a single page of cleanly styled notes/highlights, which can then be copied to one's clipboard and pasted into a local text repository (OneNote, Evernote, DevonThink, etc.). The highlights and notes can also be downloaded in a number of formats (e.g. JSON).
|
||||
|
||||
# Contributing
|
||||
|
||||
## Workflow
|
||||
|
||||
### Setting up project for development
|
||||
|
||||
1. hg clone the project locally.
|
||||
1. npm install
|
||||
1. Copy *.example.json to *.json and fill in real credentials.
|
||||
|
||||
### Installing a module
|
||||
|
||||
rm npm-shrinkwrap.json & npm i [MODULE] --save & npm shrinkwrap
|
||||
|
||||
### Updating all packages
|
||||
|
||||
........
|
||||
|
||||
### Releasing a version
|
||||
|
||||
1. Commit code with a sensible comment.
|
||||
1. `grunt release:prerelease` to:
|
||||
1. Increment the version number (using `npm version prerelease`).
|
||||
1. Commit the change to the repository.
|
||||
1. Publish to Azure (but not the directory served publicly).
|
||||
1. Notify Rollbar of the new sourcemap to download.
|
||||
|
||||
or `grunt release:major`, `release:minor`, or `release:patch` to perform the steps above and additionally release live (publish to the 'latest' directory in Azure).
|
||||
|
||||
### Testing CORS support on Azure
|
||||
|
||||
```
|
||||
Preflight request:
|
||||
curl -H "Origin: https://read.amazon.com" -H "Access-Control-Request-Method: GET" -i -X OPTIONS --verbose http://norbauercdn.blob.core.windows.net/bookcision/latest/bookcision.js
|
||||
```
|
||||
```
|
||||
curl -H "Origin: https://read.amazon.com" --verbose http://norbauercdn.blob.core.windows.net/bookcision/latest/bookcision.js
|
||||
```
|
||||
105
Tasks.todo
Normal file
@@ -0,0 +1,105 @@
|
||||
// Install Sublime Text plugin PlainTasks to light-up functionality for this todo list
|
||||
// https://github.com/aziz/PlainTasks
|
||||
|
||||
Now:
|
||||
☐ Fix XML encoding, test Excel important
|
||||
☐ EndNote integration for Lawrence Lessig
|
||||
☐ Add more logging when Amazon returns 500 error
|
||||
☐ Investigate whitespace preservation (<br>)
|
||||
|
||||
Later:
|
||||
☐ Enable Prettier
|
||||
☐ Upgrade rollbar to latest version
|
||||
☐ Better unit tests
|
||||
☐ TypeScript conversion
|
||||
☐ Update Node version, NPM, Webpack, other dependencies
|
||||
☐ Support to download all books
|
||||
|
||||
Neglected scrap heap of what was important:
|
||||
☐ Prevent initializing bookmarklet a second time while Modal Dialog is already open (close dialog and refresh, prob?)
|
||||
Release Management:
|
||||
☐ `grunt release`
|
||||
- publish an RC that is auto-bumped with 'rcN' but doesn't have to be committed and tagged in hg
|
||||
☐ Get code coverage numbers to measure progress in adding tests
|
||||
☐ Rollbar integration: sprinkle informational messages throughout code, perhaps all FEEDBACK messages that indicate error.
|
||||
☐ custom templates for download, either checkboxes next to fields to include OR custom handlebar templates
|
||||
|
||||
Neglected scrap heap of what was not important:
|
||||
☐ Add count of highlights and notes to html output
|
||||
☐ Update bootstrap version
|
||||
☐ Update all /vendor script versions
|
||||
☐ Revisit updating all packages
|
||||
☐ Send pull request to Sinon project to switch them to UMD, revisit updating Sinon dependency
|
||||
☐ Try updating jade-loader again (https://github.com/webpack/jade-loader/issues/4#issuecomment-45467651)
|
||||
☐ How does .bin dir work in node? move test.bat?
|
||||
☐ Find a way of testing browser-specific (e.g. DOM) code, such as amazonScraper.js
|
||||
☐ ZeroClipboard is swallowing exceptions: that's bad!
|
||||
☐ Stop hardcoding z-indices
|
||||
☐ Reduce file-size
|
||||
☐ Possibly switch from bootstrap progress bars to http://nanobar.micronube.com/
|
||||
☐ Switch from move.js to velocity
|
||||
☐ Remove icon bullshit (currently used in bootstrap buttons I think)
|
||||
☐ Switch to using webpack-dev-server for possibly faster build environment? (or switch to 100% automated tests)
|
||||
|
||||
Archive:
|
||||
✔ Cleanup this tasks list. @done (July 22nd 2017, 12:27)
|
||||
✔ Open source bookcision @done (July 22nd 2017, 12:31)
|
||||
✘ Settle on and enforce a convention wrt single/double quotes! Jesus christ. @canceled (July 22nd 2017, 12:31)
|
||||
✘ Replace Google Analytics with Application Insights? @canceled (July 22nd 2017, 12:31)
|
||||
✘ redo handlebars-loader example from bookcision @canceled (July 22nd 2017, 12:32)
|
||||
✘ Make feedback() store older messages on top and newer messages below. @canceled (July 22nd 2017, 12:27)
|
||||
✘ General deploy tracking as well? @canceled (July 22nd 2017, 12:27)
|
||||
✘ Add dialog to old version to point people to new version @canceled (July 22nd 2017, 12:27)
|
||||
✘ grunt changelog @canceled (July 22nd 2017, 12:27)
|
||||
✘ generate webpack profile for analysis tool @canceled (July 22nd 2017, 12:27)
|
||||
- Switch to gulp to enable this, since grunt-webpack doesn't support profile functionality? (issue reported)
|
||||
✔ Book.get should not be called if title or other props are not found (https://rollbar.com/altano/bookcision/items/53/) @done (14-06-14 13:55) @project(Bugs)
|
||||
✔ "latest" doesn't actually reflect new version! @done (14-06-15 02:10) @project(Priority 0)
|
||||
✔ Send duck a list of new features and explain privacy implications of exception telemetry. @done (14-07-04 15:23) @project(Priority 0)
|
||||
✔ Capture minreq and cornet errors @done (14-06-15 00:34) @project(Priority 0)
|
||||
✔ Need to pass `only2xx` option to minreq ({uri: XXX, only2xx: true}, see https://github.com/fb55/node-minreq/blob/master/index.js) @done (14-06-14 19:56) @project(Priority 0)
|
||||
✔ Need to capture cornet errors. @done (14-06-14 19:56) @project(Priority 0)
|
||||
✔ Pass both up to scraper and then BookScraper, connect to failCallback which is currently being dropped on the floor. @done (14-06-14 19:56) @project(Priority 0)
|
||||
✔ Replace minreq with request (https://github.com/fb55/node-minreq/issues/4) @done (14-07-05 01:13) @project(Priority 0)
|
||||
✔ publish a final version that was auto-bumped and is committed and tagged in hg @done (14-06-14 13:56) @project(Priority 0 / Release Management)
|
||||
✔ Remove rollbar access token from source control (and change it?) @done (14-06-10 23:28) @project(Priority 0)
|
||||
✔ Move to commonJS rollbar.js (see github issue) @done (14-06-10 23:21) @project(Priority 0)
|
||||
✘ Investigate webpack error: "File "dest/bookmarklet.debug.html" created. >> Destination not written because compiled files were empty." @cancelled (14-06-09 11:58) @project(Priority 2 - Whenever)
|
||||
✔ Make setting the Azure storage CORS configuration (cors.xml) part of the deploy process so that it doesn't need to be done through the VS solution (or at least check-in the VS solution to hg). @done (14-06-09 11:58) @project(Priority 2 - Whenever)
|
||||
✔ Remove test.old directory @done (14-06-08 19:32) @project(Priority 0)
|
||||
✔ Run "npm outdated" and update various libraries @done (14-06-08 12:41) @project(Priority 2 - Whenever)
|
||||
✔ Update Ryan's link to Azure version of Bookcision @done (14-06-08 12:25) @project(Priority 0)
|
||||
✔ Switch to filesaver.js for saving files. @done (14-06-08 12:25) @project(Priority 0)
|
||||
✔ Make it so that there are only two modes to publish to Azure: @done (14-06-08 12:25) @project(Priority 0)
|
||||
✔ Auto-tag the release: https://github.com/darsain/grunt-tagrelease @done (14-06-08 12:25) @project(Priority 0)
|
||||
✔ Auto-bump version: https://github.com/Darsain/grunt-bumpup / https://github.com/vojtajina/grunt-bump @done (14-06-08 12:25) @project(Priority 0)
|
||||
✔ Get report back from user who was hitting errors. @done (14-06-07 14:38) @project(Priority 0)
|
||||
✘ Find a way to just include font icons used (e.g. using http://fontello.com/ or something) @cancelled (14-06-05 01:23) @project(Priority 2 - Whenever)
|
||||
✔ Look into client-side error reporting (Airbrake? - http://airbrake.io/blog/notifier/state-client-side-javascript-error-reporting/) @done (14-06-05 01:23) @project(Priority 2 - Whenever)
|
||||
✘ Warning when user is not seeing all of their highlights/notes @cancelled (14-06-04 23:39) @project(Priority 0)
|
||||
✔ swap out JSON retrieval with HTML scraping @done (14-06-04 23:38) @project(Priority 0)
|
||||
✔ Write tests that exercise data retrieval @done (14-06-04 23:38) @project(Priority 0)
|
||||
✔ Switch to screen-scraping for highlights and notes (now that location data is totally busted (thanks Obama)) @done (14-06-04 23:38) @project(Priority 0)
|
||||
✔ Refactor code so that JSON retrieval is in one part of code @done (14-06-04 23:38) @project(Priority 0)
|
||||
✔ Add test suite @done (14-06-04 23:38) @project(Priority 0)
|
||||
✘ Update font awesome @cancelled (14-06-04 01:06) @project(Misc)
|
||||
✔ Make sure that DEBUG flag (now moved in the Gruntfile) still works for release. @done (14-06-02 03:16) @project(Priority 0)
|
||||
✔ Respond to Tobias' code review for handlebars-loader for webpack, fix issues he brings up @done (14-06-02 03:15) @project(Misc)
|
||||
✔ Stacktraces @done (14-05-26 18:05) @project(Priority 0)
|
||||
✔ Source map support @done (14-05-26 18:05) @project(Priority 0)
|
||||
✔ Referer (book URL) logging? @done (14-05-26 18:05) @project(Priority 0)
|
||||
✔ Notify of source map download on deploy @done (14-05-26 18:05) @project(Priority 0)
|
||||
✔ Fix source maps @done (14-05-26 18:05) @project(Priority 0)
|
||||
✔ Capture user info to telemetry @done (14-05-26 18:05) @project(Priority 0)
|
||||
✔ Capture bookcision version info in telemetry @done (14-05-26 18:05) @project(Priority 0)
|
||||
✔ Add exception reporting @done (14-05-26 18:05) @project(Priority 0)
|
||||
✔ Move access keys out of code @done (14-05-26 15:48) @project(Rollbar integration)
|
||||
✔ Switch to running mocha in PhantomJS? @done (14-02-22 22:28) @project(Priority 0)
|
||||
✔ Add a grunt task that runs mocha tests before allowing publish of new version @done (14-01-12 03:56) @project(Priority 0)
|
||||
✔ Experiment with Mocha @done (14-01-12 03:55) @project(Priority 0)
|
||||
✔ Test clipboard functionality in IE and FireFox @done (13-09-14 20:42) @project(Misc)
|
||||
✔ Fix IE Bug: zeroclipboard flash movie is being rendered below the button @done (13-09-14 20:42) @project(Misc)
|
||||
✔ Factor out the HTMl for a bootstrap button, light up with BootstrapButton.js @done (13-09-13 02:16) @project(Misc)
|
||||
✔ Clean up package.json @done (13-09-13 02:16) @project(Misc)
|
||||
✔ Separate out lib directory into UI and backend @done (13-09-13 02:15) @project(Misc)
|
||||
✔ Fix the pull-quotes @done (13-09-13 02:15) @project(Misc)
|
||||
4
azure.example.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"AZURE_STORAGE_ACCOUNT": "norbauercdn",
|
||||
"AZURE_STORAGE_ACCESS_KEY": "XXXXXXXXXXXXXXXXXXXXXXX"
|
||||
}
|
||||
21
bookcision.sublime-project
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"folders":
|
||||
[
|
||||
{
|
||||
"file_exclude_patterns": ["*.sublime-workspace"],
|
||||
|
||||
"folder_exclude_patterns":
|
||||
[
|
||||
".hg",
|
||||
"node_modules",
|
||||
"obj",
|
||||
"web_modules",
|
||||
"dest"
|
||||
],
|
||||
|
||||
"binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],
|
||||
|
||||
"path": "/C/src/bookcision"
|
||||
}
|
||||
]
|
||||
}
|
||||
32
fileSizeHistory.markdown
Normal file
@@ -0,0 +1,32 @@
|
||||
# BEFORE DROPDOWN MENU
|
||||
|
||||
Asset Size Chunks Chunk Names
|
||||
bookcision.debug.js 86051 0 [emitted] main
|
||||
bookcision.debug.js.map 115216 0 [emitted] main
|
||||
|
||||
bookcision.js 35164 0 [emitted] main
|
||||
bookcision.js.map 211705 0 [emitted] main
|
||||
|
||||
# AFTER DROPDOWN MENU
|
||||
|
||||
bookcision.debug.js 146794 0 [emitted] main
|
||||
bookcision.debug.js.map 185404 0 [emitted] main
|
||||
|
||||
bookcision.js 85458 0 [emitted] main
|
||||
bookcision.js.map 315242 0 [emitted] main
|
||||
|
||||
# AFTER DROPDOWN MENU + OPTIMIZATION
|
||||
|
||||
bookcision.debug.js 123955 0 [emitted] main
|
||||
bookcision.debug.js.map 160569 0 [emitted] main
|
||||
|
||||
bookcision.js 63629 0 [emitted] main
|
||||
bookcision.js.map 280826 0 [emitted] main
|
||||
|
||||
# v1.0.8 - AFTER MAJOR RESTRUCTURING, INCLUDING ADDING FONT-AWESOME FONTS
|
||||
|
||||
bookcision.debug.js 172037 0 [emitted] main
|
||||
bookcision.debug.js.map 608426 0 [emitted] main
|
||||
|
||||
bookcision.js 121147 0 [emitted] main
|
||||
bookcision.js.map 606816 0 [emitted] main
|
||||
4515
npm-shrinkwrap.json
generated
Normal file
81
package.json
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"name": "bookcision",
|
||||
"private": true,
|
||||
"version": "4.0.4-0",
|
||||
"engines": {
|
||||
"node": "0.10.35"
|
||||
},
|
||||
"tagline": "Excise your notes/highlights from read.amazon.com",
|
||||
"description": "When highlights and notes are created on any Kindle device, they are synced up to Amazon's cloud. These are then visible at read.amazon.com, but there is no reason to believe that Amazon will continue to provide this service forever, and our ability to work with text in that hosted browser-based environment is limited. This is a bookmarklet that permits one to excise notes/highlights from read.amazon.com. It yields a single page of cleanly styled notes/highlights, which can then be copied to one's clipboard and pasted into a local text repository (OneNote, Evernote, DevonThink, etc.). The highlights and notes can also be downloaded in a number of formats (e.g. JSON).",
|
||||
"keywords": [
|
||||
"kindle",
|
||||
"note",
|
||||
"highlight"
|
||||
],
|
||||
"author": "Ryan Norbauer <ryan@norbauer.com> (http://ryan.norbauer.com)",
|
||||
"bugs": {
|
||||
"email": "ryan@norbauer.com"
|
||||
},
|
||||
"homepage": "http://www.norbauer.com/bookcision",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "grunt test"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": "~0.9.0",
|
||||
"change-case": "2.1.1",
|
||||
"cheerio": "~0.16.0",
|
||||
"cornet": "~0.1.5",
|
||||
"coverjs-loader": "~0.5.0",
|
||||
"css-loader": "~0.6.12",
|
||||
"dom-storage": "~2.0.1",
|
||||
"entities": "^1.1.1",
|
||||
"expose-loader": "~0.5.3",
|
||||
"extended-exceptions": "~2.1.0",
|
||||
"fade": "0.2.0",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-asciify": "~0.2.2",
|
||||
"grunt-azureblob": "~0.1.2",
|
||||
"grunt-cli": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-0.1.13.tgz",
|
||||
"grunt-contrib-clean": "~0.5.0",
|
||||
"grunt-contrib-connect": "~0.7.1",
|
||||
"grunt-contrib-copy": "~0.5.0",
|
||||
"grunt-contrib-jade": "~0.12.0",
|
||||
"grunt-contrib-livereload": "~0.1.2",
|
||||
"grunt-contrib-uglify": "~0.4.0",
|
||||
"grunt-env": "~0.4.1",
|
||||
"grunt-hg-release": "git+https://github.com/altano/grunt-hg-release.git",
|
||||
"grunt-open": "~0.2.3",
|
||||
"grunt-regarde": "~0.1.1",
|
||||
"grunt-simple-mocha": "~0.4.0",
|
||||
"grunt-webpack": "~1.0.7",
|
||||
"handlebars": "2.x",
|
||||
"handlebars-loader": "0.1.x",
|
||||
"html-util": "~0.2.1",
|
||||
"htmlparser2": "~3.7.2",
|
||||
"hyperquest": "~0.3.0",
|
||||
"imports-loader": "~0.6.3",
|
||||
"jade-loader": "~0.5.1",
|
||||
"json-loader": "~0.5.1",
|
||||
"key": "~0.1.11",
|
||||
"less-loader": "~0.7.5",
|
||||
"markdown-js": "0.0.3",
|
||||
"matchdep": "~0.3.0",
|
||||
"mitm": "~0.5.1",
|
||||
"multipost": "0.0.3",
|
||||
"object-path": "~0.5.0",
|
||||
"param-case": "~0.1.0",
|
||||
"raw-loader": "~0.5.1",
|
||||
"script-loader": "~0.5.2",
|
||||
"set": "~1.1.1",
|
||||
"should": "~4.0.1",
|
||||
"sinon": "~1.8.2",
|
||||
"style-loader": "~0.6.4",
|
||||
"vibe": "~0.9.4",
|
||||
"webpack": "~1.3.0-beta5",
|
||||
"webpack-dev-server": "^1.7.0",
|
||||
"xmlhttprequest": "~1.6.0",
|
||||
"zeroclipboard": "~1.1.7"
|
||||
},
|
||||
"devDependencies": {}
|
||||
}
|
||||
4
rollbar.example.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"client_access_token": "XXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"server_access_token": "XXXXXXXXXXXXXXXXXXXXXXX"
|
||||
}
|
||||
11
src/bookmarklet.jade
Normal file
@@ -0,0 +1,11 @@
|
||||
doctype
|
||||
html
|
||||
head
|
||||
title= pkg.name
|
||||
body
|
||||
a#bookmarklet(href="javascript:void(0)") #{pkg.name}
|
||||
| - Drag this link to your bookmark bar
|
||||
if (typeof debug === "undefined")
|
||||
script(src="bookmarklet.js")
|
||||
else
|
||||
script(src="bookmarklet.debug.js")
|
||||
31
src/bookmarklet.js
Normal file
@@ -0,0 +1,31 @@
|
||||
(function() {
|
||||
/* By making this a function rather than an inline string, we allow minification of this code. */
|
||||
var makeAbsoluteUrlFromRelative = function(relativeUrl) {
|
||||
var a = document.createElement('a');
|
||||
a.href = relativeUrl;
|
||||
return a.href;
|
||||
};
|
||||
|
||||
var makeSchemeRelativeUrlFromAbsolute = function(absoluteUrl) {
|
||||
return absoluteUrl.replace(/^https?:/, '');
|
||||
};
|
||||
|
||||
var bookmarkletCode = function(codeURL) {
|
||||
var scriptElement = document.createElement('script');
|
||||
scriptElement.setAttribute('src', codeURL);
|
||||
scriptElement.setAttribute('crossorigin', 'anonymous');
|
||||
document.body.appendChild(scriptElement);
|
||||
};
|
||||
|
||||
var codeURL = DEBUG
|
||||
? makeSchemeRelativeUrlFromAbsolute(
|
||||
makeAbsoluteUrlFromRelative('bookcision.debug.js')
|
||||
)
|
||||
: makeSchemeRelativeUrlFromAbsolute(
|
||||
makeAbsoluteUrlFromRelative('bookcision.js')
|
||||
);
|
||||
var a = document.querySelector('a#bookmarklet');
|
||||
/*jshint scripturl:true*/
|
||||
a.href =
|
||||
'javascript:(' + bookmarkletCode.toString() + "('" + codeURL + "'));";
|
||||
})();
|
||||
1
src/enableStrictMode.js
Normal file
@@ -0,0 +1 @@
|
||||
'use strict';
|
||||
57
src/excisor/Book.js
Normal file
@@ -0,0 +1,57 @@
|
||||
// Current schema:
|
||||
// {
|
||||
// "asin": "B00AA36R4U",
|
||||
// "title": "CLR via C# (Microsoft, Developer Reference)",
|
||||
// "authors": "Jeffrey Richter",
|
||||
// "highlights": [array of Highlight objects]
|
||||
// }
|
||||
|
||||
var Highlight = require('excisor/Highlight');
|
||||
var BookScraper = require('excisor/BookScraper');
|
||||
var amazonScraper = require('excisor/amazonScraper');
|
||||
|
||||
// @TODO Investigate switching to promises
|
||||
|
||||
var Book = function(asin, title, authors, highlights) {
|
||||
this.asin = asin;
|
||||
this.title = title;
|
||||
this.authors = authors;
|
||||
this.highlights = highlights;
|
||||
};
|
||||
|
||||
module.exports = Book;
|
||||
|
||||
Book.get = function(asin, doneCallback, failCallback) {
|
||||
if (DEBUG && location.hostname === 'localhost') {
|
||||
var title = '1Q84';
|
||||
var authors = 'Haruki Murakami, Jay Rubin, Philip Gabriel';
|
||||
var testData = require('test/data/data.js');
|
||||
|
||||
var highlights = testData.pinker.highlights.map(function(rawHighlight) {
|
||||
return new Highlight(rawHighlight);
|
||||
});
|
||||
|
||||
var book = new Book(asin, title, authors, highlights);
|
||||
|
||||
doneCallback(book);
|
||||
} else if (!asin) {
|
||||
failCallback(
|
||||
new Book.NotFoundError("Missing 'asin,' 'title,' or 'authors' field")
|
||||
);
|
||||
} else {
|
||||
new BookScraper({
|
||||
asin: asin,
|
||||
doneCallback: function(asin, title, authors, highlights) {
|
||||
var book = new Book(asin, title, authors, highlights);
|
||||
doneCallback(book);
|
||||
},
|
||||
failCallback: failCallback
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var EE = require('extended-exceptions');
|
||||
Book.NotFoundError = EE.create_custom_error(
|
||||
'BookNotFoundError',
|
||||
EE.RuntimeError
|
||||
);
|
||||
273
src/excisor/BookScraper.js
Normal file
@@ -0,0 +1,273 @@
|
||||
var scrape = require('lib/scrape');
|
||||
var util = require('util');
|
||||
var $ = require('cheerio');
|
||||
var Highlight = require('excisor/Highlight');
|
||||
var url = require('url');
|
||||
var string = require('lib/string');
|
||||
var amazonScraper = require('excisor/amazonScraper');
|
||||
var entities = require('entities');
|
||||
|
||||
function log() {
|
||||
// console.log.apply(null, arguments);
|
||||
}
|
||||
|
||||
function BookScraper(options) {
|
||||
if (!options.asin) {
|
||||
throw new Error('Must specify an asin.');
|
||||
}
|
||||
|
||||
this.options = options;
|
||||
|
||||
var defaultHostname = 'read.amazon.com';
|
||||
if (TEST) {
|
||||
this.host = options.hostnameOverride_TESTONLY || defaultHostname;
|
||||
} else {
|
||||
this.host = location.hostname || defaultHostname;
|
||||
}
|
||||
|
||||
this.scrapedData = {
|
||||
asin: options.asin,
|
||||
title: null,
|
||||
authors: null,
|
||||
highlights: []
|
||||
};
|
||||
|
||||
this.queueNextChunkScraping();
|
||||
}
|
||||
|
||||
BookScraper.prototype.queueNextChunkScraping = function() {
|
||||
var index = this.scrapedData.highlights.length;
|
||||
|
||||
log('queue next chunk w/ ' + index + ' highlights already.');
|
||||
log(
|
||||
'amazonScraper.getAmazonDeviceType(): ',
|
||||
amazonScraper.getAmazonDeviceType()
|
||||
);
|
||||
|
||||
var url = util.format(
|
||||
'https://%s/kp/notebook?purpose=NOTEBOOK&amazonDeviceType=%s&appName=notebook&asin=%s&contentLimitState=%s',
|
||||
this.host,
|
||||
amazonScraper.getAmazonDeviceType(),
|
||||
this.options.asin,
|
||||
amazonScraper.getContentLimitState()
|
||||
);
|
||||
|
||||
if (index !== 0) {
|
||||
url += '&index=' + index;
|
||||
}
|
||||
|
||||
this.scrapeChunk(index, url);
|
||||
};
|
||||
|
||||
BookScraper.prototype.onChunkScraped = function(
|
||||
asin,
|
||||
title,
|
||||
authors,
|
||||
highlights
|
||||
) {
|
||||
var that = this;
|
||||
that.scrapedData.title = that.scrapedData.title || title;
|
||||
that.scrapedData.authors = that.scrapedData.authors || authors;
|
||||
|
||||
if (highlights && highlights.length > 0) {
|
||||
log(
|
||||
'onChunkScraped: found ' +
|
||||
highlights.length +
|
||||
' highlights' +
|
||||
' on the existing ' +
|
||||
that.scrapedData.highlights.length +
|
||||
' highlights.'
|
||||
);
|
||||
|
||||
if (TEST) {
|
||||
highlights.forEach(function(highlight, index) {
|
||||
highlights.forEach(function(currentHighlight, currentIndex) {
|
||||
if (
|
||||
highlight !== currentHighlight &&
|
||||
highlight.location.value === currentHighlight.location.value &&
|
||||
highlight.text === currentHighlight.text
|
||||
) {
|
||||
// log('Found duplicate highlight with location value: ' + highlight.location.value);
|
||||
// log('First duplicate: ', highlight);
|
||||
// log('Next duplicate: ', currentHighlight);
|
||||
log(highlights);
|
||||
throw new Error(
|
||||
'Found duplicate highlight with location value: ' +
|
||||
highlight.location.value +
|
||||
' first location: ' +
|
||||
index +
|
||||
' and duplicate location ' +
|
||||
currentIndex
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
highlights.forEach(function(highlight) {
|
||||
that.scrapedData.highlights.forEach(function(scrapedHighlight) {
|
||||
if (highlight.location.value === scrapedHighlight.location.value) {
|
||||
// log('Found duplicate highlight with location value: ' + highlight.location.value);
|
||||
throw new Error(
|
||||
'Found duplicate highlight with location value: ' +
|
||||
highlight.location.value
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
log('First highlight: ', highlights[0]);
|
||||
log('Last highlight: ', highlights[highlights.length - 1]);
|
||||
}
|
||||
|
||||
that.scrapedData.highlights = that.scrapedData.highlights.concat(
|
||||
highlights
|
||||
);
|
||||
// We got some highlights so make another request
|
||||
that.queueNextChunkScraping();
|
||||
} else if (that.options.doneCallback) {
|
||||
log('onChunkScraped: found 0 highlights, calling doneCallback');
|
||||
// We got no highlights from this request so we must have reached the end of the highlights
|
||||
that.options.doneCallback(
|
||||
that.scrapedData.asin,
|
||||
that.scrapedData.title,
|
||||
that.scrapedData.authors,
|
||||
that.scrapedData.highlights
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
BookScraper.prototype.scrapeChunk = function(index, url) {
|
||||
log(url);
|
||||
|
||||
var that = this;
|
||||
var options = this.options;
|
||||
|
||||
log(JSON.stringify(options));
|
||||
|
||||
scrape(
|
||||
url,
|
||||
function(scraper) {
|
||||
var highlights = [];
|
||||
var title, authors;
|
||||
|
||||
if (options.failCallback) {
|
||||
scraper.on('error', function(err) {
|
||||
options.failCallback(new BookScraper.ScrapeError(err));
|
||||
});
|
||||
}
|
||||
|
||||
scraper.on('dom', function() {
|
||||
that.onChunkScraped(options.asin, title, authors, highlights);
|
||||
});
|
||||
|
||||
// <h3 class="a-spacing-top-small a-color-base kp-notebook-selectable kp-notebook-metadata">The Blank Slate: The Modern Denial of Human Nature</h3>
|
||||
var foundTitle = scraper.select(
|
||||
'.a-spacing-top-small.a-color-base.kp-notebook-selectable.kp-notebook-metadata',
|
||||
function(titleLink) {
|
||||
title = $(titleLink).text().trim();
|
||||
title = entities.decodeHTML(title);
|
||||
log('found title: ' + title);
|
||||
if (options.onTitle) {
|
||||
// console.log('about to call onTitle with: ' + title);
|
||||
options.onTitle(title);
|
||||
}
|
||||
scraper.removeListener('element', foundTitle);
|
||||
}
|
||||
);
|
||||
|
||||
// <h1 class="a-size-base a-spacing-top-micro a-color-secondary kp-notebook-selectable kp-notebook-metadata">Steven Pinker</h1>
|
||||
var foundAuthors = scraper.select(
|
||||
'.a-size-base.a-spacing-top-micro.a-color-secondary.kp-notebook-selectable.kp-notebook-metadata',
|
||||
function(authorsSpan) {
|
||||
authors = $(authorsSpan).text().trim();
|
||||
authors = entities.decodeHTML(authors);
|
||||
authors = string.startsWith(authors, 'by ')
|
||||
? authors.substring(3)
|
||||
: authors;
|
||||
if (options.onAuthors) {
|
||||
options.onAuthors(authors);
|
||||
}
|
||||
scraper.removeListener('element', foundAuthors);
|
||||
}
|
||||
);
|
||||
|
||||
// div#kp-notebook-annotations div
|
||||
// Location:
|
||||
// - <input type="hidden" name="" value="6498" id="kp-annotation-location">
|
||||
// Note:
|
||||
// - No note: <span id="note" class="a-size-base-plus a-color-base"></span>
|
||||
// - Note: <span id="note" class="a-size-base-plus a-color-base">this is why behavior analysis is still useful and valid</span>
|
||||
// Highlight:
|
||||
// - Highlight: <span id="highlight" class="a-size-base-plus a-color-base">expropriate</span>
|
||||
var selector =
|
||||
index === 0
|
||||
? '#kp-notebook-annotations > div'
|
||||
: 'div.a-row.a-spacing-base';
|
||||
scraper.select(selector, function(highlightContainer) {
|
||||
var noteElement = $(highlightContainer).find('span#note:not(:empty)');
|
||||
var noteText = $(noteElement).text().trim();
|
||||
noteText = entities.decodeHTML(noteText);
|
||||
var hasNote = Boolean(noteText && string.isNotEmpty(noteText));
|
||||
|
||||
var highlightElement = $(highlightContainer).find(
|
||||
'span#highlight:not(:empty)'
|
||||
);
|
||||
var highlightText = $(highlightElement).text().trim();
|
||||
highlightText = entities.decodeHTML(highlightText);
|
||||
var hasHighlight = Boolean(
|
||||
highlightText && string.isNotEmpty(highlightText)
|
||||
);
|
||||
|
||||
var isNoteOnly = hasNote && !hasHighlight;
|
||||
|
||||
var locationElement = $(highlightContainer).find(
|
||||
'#kp-annotation-location'
|
||||
);
|
||||
var locationText = $(locationElement).val();
|
||||
var locationValue = parseInt(locationText, 10);
|
||||
|
||||
var kindleUrl = util.format(
|
||||
'kindle://book?action=open&asin=%s&location=%d',
|
||||
that.options.asin,
|
||||
locationValue
|
||||
);
|
||||
|
||||
// -------------------------------
|
||||
|
||||
if (hasNote || hasHighlight) {
|
||||
var highlight = new Highlight({
|
||||
text: highlightText,
|
||||
isNoteOnly: isNoteOnly,
|
||||
location: {
|
||||
url: kindleUrl,
|
||||
value: locationValue
|
||||
},
|
||||
note: hasNote ? noteText : null
|
||||
});
|
||||
|
||||
// Filter out duplicate highlights since I can't make heads or tails out of how to get the API to return the right # of items
|
||||
var alreadyExists = that.scrapedData.highlights.some(function(
|
||||
scrapedHighlight
|
||||
) {
|
||||
return Highlight.isEqual(scrapedHighlight, highlight);
|
||||
});
|
||||
if (!alreadyExists) {
|
||||
highlights.push(highlight);
|
||||
|
||||
if (options.onHighlight) {
|
||||
options.onHighlight(highlight);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}.bind(this)
|
||||
);
|
||||
};
|
||||
|
||||
module.exports = BookScraper;
|
||||
|
||||
var EE = require('extended-exceptions');
|
||||
BookScraper.ScrapeError = EE.create_custom_error(
|
||||
'BookScraperScrapeError',
|
||||
EE.RuntimeError
|
||||
);
|
||||
21
src/excisor/Highlight.js
Normal file
@@ -0,0 +1,21 @@
|
||||
var mapSourceObjectOntoSinkObject = require('lib/mapSourceObjectOntoSinkObject');
|
||||
|
||||
var Highlight = function(data) {
|
||||
mapSourceObjectOntoSinkObject(data, this);
|
||||
};
|
||||
|
||||
Highlight.isEqual = function(a, b) {
|
||||
var allFields = Highlight.schema.requiredFields.concat(
|
||||
Highlight.schema.optionalFields
|
||||
);
|
||||
return allFields.every(function(field) {
|
||||
return a[field] === b[field];
|
||||
});
|
||||
};
|
||||
|
||||
Highlight.schema = {
|
||||
requiredFields: ['text', 'isNoteOnly', 'location.url', 'location.value'],
|
||||
optionalFields: ['note']
|
||||
};
|
||||
|
||||
module.exports = Highlight;
|
||||
89
src/excisor/amazonScraper.js
Normal file
@@ -0,0 +1,89 @@
|
||||
var array = require('lib/array'),
|
||||
string = require('lib/string'),
|
||||
dom = require('lib/browser/dom'),
|
||||
functional = require('lib/functional');
|
||||
|
||||
module.exports = (function() {
|
||||
var extractASIN = function() {
|
||||
var asin = null;
|
||||
|
||||
// First try: window.workData is currently prepopulated with all the data we need.
|
||||
if (
|
||||
typeof workData !== 'undefined' &&
|
||||
workData !== null &&
|
||||
workData.asin &&
|
||||
workData.asin.trim().length > 0
|
||||
) {
|
||||
asin = workData.asin.trim();
|
||||
} else {
|
||||
var candidates = [
|
||||
dom.extractStringFromElement('input[name=asin]'),
|
||||
dom.extractStringFromElement('input#kp-notebook-annotations-asin'),
|
||||
];
|
||||
|
||||
asin = candidates.find(Boolean);
|
||||
}
|
||||
|
||||
if (!asin && localStorage && localStorage.getItem('last_app_activity')) {
|
||||
// Second try: check known DOM element that contains the string
|
||||
// read.amazon.com (Cloud Reader)
|
||||
try {
|
||||
var lastAppActivity = JSON.parse(
|
||||
localStorage.getItem('last_app_activity')
|
||||
);
|
||||
asin = lastAppActivity.asin;
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
return asin;
|
||||
};
|
||||
|
||||
// {name: XYZ, profileUrl: <URL>}
|
||||
var extractUser = function() {
|
||||
var user = null;
|
||||
|
||||
if (
|
||||
typeof viewerData !== 'undefined' &&
|
||||
viewerData !== null &&
|
||||
viewerData.customerId &&
|
||||
viewerData.customerId.length > 0
|
||||
) {
|
||||
user = {
|
||||
id: viewerData.customerId,
|
||||
};
|
||||
}
|
||||
|
||||
return user;
|
||||
};
|
||||
|
||||
var extractAmazonDeviceType = function() {
|
||||
var deviceType =
|
||||
typeof window !== 'undefined' && window.KindleGlobal
|
||||
? window.KindleGlobal.amazonDeviceType
|
||||
: null;
|
||||
if (!deviceType) {
|
||||
deviceType = 'A2CLFWBIMVSE9N';
|
||||
}
|
||||
|
||||
return deviceType;
|
||||
};
|
||||
|
||||
var extractContentLimitState = function() {
|
||||
if (TEST) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return typeof $ !== undefined
|
||||
? $('.kp-notebook-content-limit-state')
|
||||
.last()
|
||||
.val()
|
||||
: null;
|
||||
};
|
||||
|
||||
return {
|
||||
findASIN: extractASIN,
|
||||
findUser: functional.memoize(extractUser),
|
||||
getAmazonDeviceType: functional.memoize(extractAmazonDeviceType),
|
||||
getContentLimitState: extractContentLimitState,
|
||||
};
|
||||
})();
|
||||
18
src/excisor/environment.js
Normal file
@@ -0,0 +1,18 @@
|
||||
var packageInfo = require('package.json'),
|
||||
CurrentScript = require('lib/CurrentScript');
|
||||
|
||||
// @TODO Duplicated from ZeroClipboardWrapper.js
|
||||
var debugSuffix = DEBUG ? '.debug' : '';
|
||||
var scriptName = packageInfo.name + debugSuffix + '.js'; // @TODO Move this into the package?
|
||||
var currentScript = new CurrentScript(scriptName);
|
||||
|
||||
switch (currentScript.parentDirectory()) {
|
||||
case 'dest':
|
||||
module.exports = 'development';
|
||||
break;
|
||||
case 'latest':
|
||||
module.exports = 'production';
|
||||
break;
|
||||
default:
|
||||
module.exports = 'staging';
|
||||
}
|
||||
25
src/excisor/stylesheets/book.less
Normal file
@@ -0,0 +1,25 @@
|
||||
.bookcision-book h1,
|
||||
.bookcision-book h2,
|
||||
.bookcision-book h3,
|
||||
.bookcision-book h4,
|
||||
.bookcision-book h5,
|
||||
.bookcision-book h6 {
|
||||
color: black;
|
||||
}
|
||||
|
||||
ul.bookcision-highlights > li, p.bookcision-no-highlights {
|
||||
padding-left: 5px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
ul.bookcision-highlights, p.bookcision-no-highlights {
|
||||
padding: 2.5rem 1rem 1rem;
|
||||
}
|
||||
|
||||
ul.bookcision-highlights {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
ul.bookcision-highlights li p:first-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
72
src/excisor/stylesheets/button-with-dropdown.less
Normal file
@@ -0,0 +1,72 @@
|
||||
.bookcision-book {
|
||||
@import "../../vendor/bootstrap-2.3.1/less/variables.less";
|
||||
@import "../../vendor/bootstrap-2.3.1/less/mixins.less";
|
||||
|
||||
@background-color: #D0D0D0;
|
||||
@submenu-background-color: #767878;
|
||||
@submenu-background-color-hover: #494949;
|
||||
@submenu-text-color: #FFFFFF;
|
||||
@downarrow-color: #FF0000;
|
||||
|
||||
*, .btn {
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.button-with-dropdown li {
|
||||
background: @background-color;
|
||||
color: @submenu-text-color;
|
||||
text-align: right;
|
||||
font-family: Helvetica, Arial, Verdana, sans-serif;
|
||||
font-size: 12px;
|
||||
line-height: 49px;
|
||||
padding: 0 20px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.button-with-dropdown ul {
|
||||
list-style: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.button-with-dropdown ul > li:last-child {
|
||||
.border-bottom-left-radius(@baseBorderRadius);
|
||||
.border-bottom-right-radius(@baseBorderRadius);
|
||||
}
|
||||
|
||||
.button-with-dropdown ul > li.active {
|
||||
background: @background-color;
|
||||
}
|
||||
|
||||
.button-with-dropdown ul > li:hover {
|
||||
background: @background-color;
|
||||
}
|
||||
|
||||
.button-with-dropdown .dropdown-toggle {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.button-with-dropdown .dropdown-toggle + ul {
|
||||
display: none;
|
||||
position: absolute;
|
||||
min-width: 100px;
|
||||
top: 100%;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.button-with-dropdown .dropdown-toggle + ul li {
|
||||
background: @submenu-background-color;
|
||||
filter: none;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
line-height: 120%;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.button-with-dropdown .dropdown-toggle + ul li:hover {
|
||||
background: @submenu-background-color-hover;
|
||||
}
|
||||
}
|
||||
15
src/excisor/stylesheets/buttons.less
Normal file
@@ -0,0 +1,15 @@
|
||||
// Hide the download button if browser doesn't support the file system APIs, since
|
||||
// we can't generate the file for download (which are Chrome only, for now).
|
||||
.no-file-system .bookcision-book .download-button-group {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.bookcision-book {
|
||||
.download-button-group, .bookcision-copy-to-clipboard {
|
||||
float: right;
|
||||
|
||||
// @TODO Investigate
|
||||
margin-top: 5px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
48
src/excisor/stylesheets/highlight.less
Normal file
@@ -0,0 +1,48 @@
|
||||
// @TODO Wrapper necessary?
|
||||
ul.bookcision-highlights {
|
||||
li p {
|
||||
padding-left: 10px;
|
||||
border-left: 4px solid #ccc;
|
||||
// text-align: justify;
|
||||
}
|
||||
|
||||
li p.bookcision-highlight-note {
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
border-left-color: #777;
|
||||
}
|
||||
|
||||
p.bookcision-note-context {
|
||||
color: #999;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
p.bookcision-highlight.with-note, p.bookcision-note-context {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
p.bookcision-note-context::after {
|
||||
content: " …";
|
||||
}
|
||||
|
||||
p.bookcision-note-context::before {
|
||||
content: "… ";
|
||||
}
|
||||
|
||||
.bookcision-location {
|
||||
text-align: right;
|
||||
border-left-style: none;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
a:link, a:hover, a:visited {
|
||||
font-size: 12px;
|
||||
text-decoration: underline;
|
||||
}
|
||||
a:link {
|
||||
color: #777;
|
||||
}
|
||||
a:hover, a:visited {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
71
src/excisor/templateEnhancer.js
Normal file
@@ -0,0 +1,71 @@
|
||||
// @TODO Move to lib
|
||||
// @TODO Rewrite this comment
|
||||
//
|
||||
// Takes a jade template (or any function that takes a context and returns
|
||||
// HTML) to the rest of the
|
||||
// application via getFragment() export. getFragment() takes an instance of an
|
||||
// object that has an associated template and returns a DocumentFragment.
|
||||
//
|
||||
// For each jade template we pull in the CSS as well as a JS file describing
|
||||
// what events should be attached to the DOM elements declared in the jade
|
||||
// template. For example for a Book instance, we would pull in the files:
|
||||
//
|
||||
// * excisor/templates/book.jade
|
||||
// * excisor/templates/book.jade.js
|
||||
// * excisor/stylesheets/book.less
|
||||
|
||||
var dom = require('lib/browser/dom');
|
||||
|
||||
module.exports = function(template, templateJS) {
|
||||
var processTemplateJS = function(object, fragment) {
|
||||
if (templateJS.events) {
|
||||
var attachHandler = function(element, eventHandlerDefinition) {
|
||||
element.addEventListener(eventHandlerDefinition.event, function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
args.unshift(object);
|
||||
eventHandlerDefinition.handler.apply(this, args);
|
||||
});
|
||||
};
|
||||
|
||||
templateJS.events.forEach(function(eventHandlerDefinition) {
|
||||
var elements = [];
|
||||
|
||||
if (eventHandlerDefinition.element)
|
||||
elements.push(eventHandlerDefinition.element);
|
||||
|
||||
if (eventHandlerDefinition.elements)
|
||||
Array.prototype.push.apply(elements, eventHandlerDefinition.elements);
|
||||
|
||||
if (eventHandlerDefinition.selector)
|
||||
Array.prototype.push.apply(
|
||||
elements,
|
||||
fragment.querySelectorAll(eventHandlerDefinition.selector)
|
||||
);
|
||||
|
||||
// We don't throw in the case of not being able to find the DOM element.
|
||||
// This is to allow templates to be flexible: if an element is
|
||||
// conditionally not added to the DOM, we just don't attach any event
|
||||
// handlers to it. No big thing.
|
||||
elements.forEach(function(element) {
|
||||
attachHandler(element, eventHandlerDefinition);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (templateJS.onAfterFragmentGenerated) {
|
||||
templateJS.onAfterFragmentGenerated.call(fragment, object, fragment);
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
getHtml: template,
|
||||
getFragment: function(object) {
|
||||
var html = template(object);
|
||||
var fragment = dom.createDocumentFragmentFromHtml(html);
|
||||
|
||||
processTemplateJS(object, fragment);
|
||||
|
||||
return fragment;
|
||||
}
|
||||
};
|
||||
};
|
||||
30
src/excisor/templates/book.jade
Normal file
@@ -0,0 +1,30 @@
|
||||
div.bootstrap.bookcision-book
|
||||
unless highlights.length === 0
|
||||
div.button-with-dropdown.download-button-group.btn-group
|
||||
button.btn.bookcision-download-as-text
|
||||
i.icon-download
|
||||
| Download
|
||||
button.btn.dropdown-toggle
|
||||
span.caret
|
||||
ul
|
||||
li.bookcision-download-as-text
|
||||
span as plain text
|
||||
li.bookcision-download-as-xml
|
||||
span as XML
|
||||
li.last.bookcision-download-as-json
|
||||
span as JSON
|
||||
button.btn.bookcision-copy-to-clipboard
|
||||
i.icon-copy
|
||||
| Copy to clipboard
|
||||
|
||||
span.bookcision-header
|
||||
h1= title
|
||||
h2 #{authors}
|
||||
|
||||
if highlights.length === 0
|
||||
p.bookcision-no-highlights You have no highlights for this book yet.
|
||||
else
|
||||
ul.bookcision-highlights
|
||||
each highlight in highlights
|
||||
li
|
||||
include highlight
|
||||
133
src/excisor/templates/book.jade.js
Normal file
@@ -0,0 +1,133 @@
|
||||
// @TODO should this file be in the 'templates' directory?
|
||||
|
||||
var bookTextTemplate = require('excisor/templates/book.txt.handlebars'),
|
||||
bookXmlTemplate = require('excisor/templates/book.xml.handlebars');
|
||||
|
||||
var bookHtmlTemplate = require('excisor/templates/book.jade');
|
||||
|
||||
require('excisor/stylesheets/book.less');
|
||||
require('excisor/stylesheets/highlight.less');
|
||||
require('excisor/stylesheets/button-with-dropdown.less');
|
||||
require('excisor/stylesheets/buttons.less');
|
||||
|
||||
var templateEnhancer = require('excisor/templateEnhancer');
|
||||
var SimplifiedFile = require('lib/browser/SimplifiedFile');
|
||||
var feedback = require('lib/ui/components/feedback');
|
||||
var css = require('lib/ui/css');
|
||||
var ClipboardButton = require('lib/ui/components/ClipboardButton');
|
||||
|
||||
var downloadableFormats = {
|
||||
text: {
|
||||
extension: 'txt',
|
||||
mimetype: 'text/plain',
|
||||
getFileContentsForDownload: bookTextTemplate
|
||||
},
|
||||
xml: {
|
||||
extension: 'xml',
|
||||
mimetype: 'application/xml',
|
||||
getFileContentsForDownload: bookXmlTemplate
|
||||
},
|
||||
json: {
|
||||
extension: 'json',
|
||||
mimetype: 'application/json',
|
||||
getFileContentsForDownload: function(data) {
|
||||
return JSON.stringify(data);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var getCleanFilename = function(filename) {
|
||||
var withoutWhitespace = filename.replace(/\s+/g, '.');
|
||||
var onlyWordCharacters = withoutWhitespace.replace(/[^\w.]/g, '');
|
||||
return onlyWordCharacters;
|
||||
};
|
||||
|
||||
var downloadBook = function(book, format) {
|
||||
if (!(format in downloadableFormats)) throw 'Unknown format specified.';
|
||||
|
||||
feedback('Writing highlights to file', 50);
|
||||
|
||||
var content = downloadableFormats[format].getFileContentsForDownload(book);
|
||||
var mimetype = downloadableFormats[format].mimetype;
|
||||
var fileName =
|
||||
'Kindle.Highlights_' +
|
||||
getCleanFilename(book.title) +
|
||||
'_' +
|
||||
String(Date.now()) +
|
||||
'.' +
|
||||
downloadableFormats[format].extension;
|
||||
|
||||
var file = new SimplifiedFile(fileName, mimetype, content);
|
||||
|
||||
file.download();
|
||||
feedback('Highlights written.', 100);
|
||||
};
|
||||
|
||||
module.exports = templateEnhancer(bookHtmlTemplate, {
|
||||
events: [
|
||||
{
|
||||
selector: '.bookcision-download-as-text',
|
||||
event: 'click',
|
||||
handler: function(book, event) {
|
||||
downloadBook(book, 'text');
|
||||
}
|
||||
},
|
||||
{
|
||||
selector: '.bookcision-download-as-xml',
|
||||
event: 'click',
|
||||
handler: function(book, event) {
|
||||
downloadBook(book, 'xml');
|
||||
}
|
||||
},
|
||||
{
|
||||
selector: '.bookcision-download-as-json',
|
||||
event: 'click',
|
||||
handler: function(book, event) {
|
||||
downloadBook(book, 'json');
|
||||
}
|
||||
},
|
||||
{
|
||||
selector: '.dropdown-toggle',
|
||||
event: 'click',
|
||||
handler: function(book, event) {
|
||||
var dropdownList = event.currentTarget.parentNode.querySelector(
|
||||
'.dropdown-toggle + ul'
|
||||
);
|
||||
dropdownList.style.display = dropdownList.style.display !== 'block'
|
||||
? 'block'
|
||||
: 'none';
|
||||
}
|
||||
}
|
||||
],
|
||||
onAfterFragmentGenerated: function(book, fragment) {
|
||||
var dropdownToggle = fragment.querySelector('.dropdown-toggle');
|
||||
var dropdownList = fragment.querySelector('.dropdown-toggle + ul');
|
||||
|
||||
// @TODO Remove the event listener from the document body when the dropdown is removed from the DOM
|
||||
// if the user clicks outside of the ul element, hide it
|
||||
if (dropdownToggle && dropdownList) {
|
||||
document.body.addEventListener('click', function(clickEvent) {
|
||||
if (!dropdownToggle.contains(clickEvent.target))
|
||||
dropdownList.style.display = 'none';
|
||||
});
|
||||
}
|
||||
|
||||
// Light up copy-to-clipboard functionality on the copy button
|
||||
var copyToClipboardButton = fragment.querySelector(
|
||||
'.bookcision-copy-to-clipboard'
|
||||
);
|
||||
if (copyToClipboardButton) {
|
||||
var clipboardContent = bookTextTemplate(book);
|
||||
var clipboardCallbacks = {
|
||||
complete: function() {
|
||||
button.flash({ icon: 'icon-ok' });
|
||||
}
|
||||
};
|
||||
var button = new ClipboardButton(
|
||||
copyToClipboardButton,
|
||||
clipboardContent,
|
||||
clipboardCallbacks
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
8
src/excisor/templates/book.txt.handlebars
Normal file
@@ -0,0 +1,8 @@
|
||||
{{{title}}}
|
||||
{{{authors}}}
|
||||
{{#each highlights}}{{#unless isNoteOnly}}
|
||||
{{{text}}}{{/unless}}{{#if note}}
|
||||
NOTE: {{{note}}}{{/if}}
|
||||
LOCATION: {{{location.value}}}
|
||||
{{else}}You have no highlights for this book yet.
|
||||
{{/each}}
|
||||
11
src/excisor/templates/book.xml.handlebars
Normal file
@@ -0,0 +1,11 @@
|
||||
<book>
|
||||
<title>{{title}}</title>
|
||||
<authors>{{authors}}</authors>
|
||||
<highlights>{{#each highlights}}
|
||||
<highlight isNoteOnly="{{$toString isNoteOnly}}">{{#unless isNoteOnly}}
|
||||
<text>{{text}}</text>{{/unless}}
|
||||
<location url="{{location.url}}">{{location.value}}</location>{{#if note}}
|
||||
<note>{{note}}</note>{{/if}}
|
||||
</highlight>{{/each}}
|
||||
</highlights>
|
||||
</book>
|
||||
11
src/excisor/templates/highlight.jade
Normal file
@@ -0,0 +1,11 @@
|
||||
if !highlight.isNoteOnly
|
||||
if highlight.note
|
||||
p.bookcision-highlight.with-note= highlight.text
|
||||
else
|
||||
p.bookcision-highlight.without-note= highlight.text
|
||||
|
||||
if highlight.note
|
||||
p.bookcision-highlight-note= highlight.note
|
||||
|
||||
p.bookcision-location
|
||||
a(href!="#{highlight.location.url}") Location: #{highlight.location.value}
|
||||
86
src/index.js
Normal file
@@ -0,0 +1,86 @@
|
||||
var browserSupport = require('lib/browser/browserSupport');
|
||||
if (!browserSupport.meetsMinimumRequirements) {
|
||||
var showUpgradeInstructions = confirm(
|
||||
'Sorry, bookcision only supports modern browsers. Would you like instructions on how to upgrade?'
|
||||
);
|
||||
if (showUpgradeInstructions) {
|
||||
window.open('http://browsehappy.com/', '_blank');
|
||||
}
|
||||
} else {
|
||||
var packageInfo = require('package.json');
|
||||
var rollbar = require('lib/rollbar.js'); // Enable rollbar integration before anything else.
|
||||
var applicationGlobal = require('lib/applicationGlobal');
|
||||
if (!applicationGlobal.initialized) {
|
||||
require('lib/polyfills');
|
||||
|
||||
// Store package.json in localStorage. Will allow us to detect on the client that we've
|
||||
// upgraded the script and who knows what else.
|
||||
var getApplicationStorage = require('lib/browser/applicationStorage');
|
||||
var applicationStorage = getApplicationStorage(packageInfo.name);
|
||||
applicationStorage.set('package.json', packageInfo);
|
||||
|
||||
applicationGlobal.initialized = true;
|
||||
}
|
||||
|
||||
var dom = require('lib/browser/dom');
|
||||
var feedback = require('lib/ui/components/feedback');
|
||||
var ModalDialog = require('lib/ui/components/ModalDialog');
|
||||
|
||||
var amazonScraper = require('excisor/amazonScraper');
|
||||
|
||||
require('lib/stylesheets/bootstrap.less'); // Make bootstrap CSS available from get-go
|
||||
require('lib/stylesheets/font-awesome.less'); // Make bootstrap CSS available from get-go
|
||||
|
||||
var isLocalhostDevelopment = DEBUG && location.hostname === 'localhost';
|
||||
if (!isLocalhostDevelopment) {
|
||||
require('vendor/googleAnalytics');
|
||||
}
|
||||
|
||||
var enhancedBookTemplate = require('excisor/templates/book.jade.js');
|
||||
var Book = require('excisor/Book');
|
||||
var BookScraper = require('excisor/BookScraper');
|
||||
|
||||
var displayModalDialogForBook = function(book) {
|
||||
feedback('Done', 100); // @TODO temporary...
|
||||
var fragment = enhancedBookTemplate.getFragment(book);
|
||||
new ModalDialog(fragment);
|
||||
};
|
||||
|
||||
var failCallback = function(error) {
|
||||
if (error instanceof Book.NotFoundError) {
|
||||
feedback('Please navigate to a specific book and try again.', 99.999); // @TODO temporary...
|
||||
rollbar.info('Activated on a non-book page.', error);
|
||||
} else if (error instanceof BookScraper.ScrapeError) {
|
||||
feedback(
|
||||
'Error retrieving highlights from Amazon, please try again...',
|
||||
99.999
|
||||
); // @TODO temporary...
|
||||
rollbar.warning('Scrape failure.', error);
|
||||
} else {
|
||||
feedback(error, 99.999); // @TODO temporary...
|
||||
}
|
||||
};
|
||||
|
||||
dom.onDocumentReady(function OnContentLoaded() {
|
||||
if (!DEBUG && location.hostname.indexOf('read.amazon.') !== 0) {
|
||||
feedback(
|
||||
'Go to read.amazon.com/notebook (or read.amazon.co.jp, read.amazon.co.uk, etc.) to start.',
|
||||
99.999
|
||||
);
|
||||
} else {
|
||||
var asin;
|
||||
|
||||
if (isLocalhostDevelopment) {
|
||||
asin = 'B004LROUW2';
|
||||
} else {
|
||||
asin = amazonScraper.findASIN();
|
||||
}
|
||||
|
||||
feedback('Loading highlights', 75); // @TODO temporary...
|
||||
|
||||
Book.get(asin, displayModalDialogForBook, failCallback);
|
||||
|
||||
// @TODO Need to make failCallback get called in case of exceptions being thrown in Book code.
|
||||
}
|
||||
});
|
||||
}
|
||||
44
src/lib/CurrentScript.js
Normal file
@@ -0,0 +1,44 @@
|
||||
var util = require('util'),
|
||||
array = require('lib/array'),
|
||||
url = require('url');
|
||||
|
||||
// Will not work with script tags where the src attribute doesn't end with the script name, such as if
|
||||
// query parameters are used for cache-circumvention.
|
||||
var CurrentScript = function(scriptName) {
|
||||
// Find the current script by searching the script tags on the page.
|
||||
this.script = null;
|
||||
var strictScriptSelector = util.format('script[src$="%s"]', scriptName);
|
||||
var matchingScripts = document.querySelectorAll(strictScriptSelector);
|
||||
if (matchingScripts.length > 0) {
|
||||
this.script = array.last(matchingScripts);
|
||||
}
|
||||
|
||||
if (!this.script) throw 'Could not find the current script ' + scriptName;
|
||||
|
||||
if (!this.script.src || this.script.src === '') throw 'Invalid script found';
|
||||
|
||||
this.url = url.parse(this.script.src, true, true);
|
||||
};
|
||||
|
||||
CurrentScript.prototype.parentDirectory = function() {
|
||||
var pathname = this.url.pathname;
|
||||
var segments = pathname.split('/');
|
||||
|
||||
if (segments.length < 2)
|
||||
throw new Error(
|
||||
'Error parsing parent directory of url ' + this.url.toString()
|
||||
);
|
||||
|
||||
return segments[segments.length - 2];
|
||||
};
|
||||
|
||||
CurrentScript.prototype.resolveUrlRelativeTo = function(relativeUrl) {
|
||||
return url.resolve(this.script.src, relativeUrl);
|
||||
};
|
||||
|
||||
CurrentScript.prototype.getOrigin = function() {
|
||||
var scriptUrl = url.parse(this.script.src);
|
||||
return scriptUrl.protocol + '//' + scriptUrl.host;
|
||||
};
|
||||
|
||||
module.exports = CurrentScript;
|
||||
22
src/lib/LimitedLengthQueue.js
Normal file
@@ -0,0 +1,22 @@
|
||||
module.exports = function LimitedLengthQueue(maxLength) {
|
||||
var items = [];
|
||||
var onAddCallbacks = []; // @TODO pubsub instead?
|
||||
|
||||
this.unshift = function(item) {
|
||||
items.unshift(item);
|
||||
|
||||
onAddCallbacks.forEach(function(callback) {
|
||||
callback(items);
|
||||
});
|
||||
|
||||
return items.length > maxLength ? items.pop() : null;
|
||||
};
|
||||
|
||||
this.empty = function() {
|
||||
items.length = 0;
|
||||
};
|
||||
|
||||
this.onItemAdded = function(callback) {
|
||||
onAddCallbacks.push(callback);
|
||||
};
|
||||
};
|
||||
21
src/lib/ZeroClipboardWrapper.js
Normal file
@@ -0,0 +1,21 @@
|
||||
var ZeroClipboard = require('ZeroClipboard'),
|
||||
packageInfo = require('package.json'),
|
||||
CurrentScript = require('lib/CurrentScript');
|
||||
|
||||
// @TODO There shouldn't be package specific code in lib directory
|
||||
var debugSuffix = DEBUG ? '.debug' : '';
|
||||
var scriptName = packageInfo.name + debugSuffix + '.js'; // @TODO Move this into the package?
|
||||
var currentScript = new CurrentScript(scriptName);
|
||||
var zeroClipboardUrl = currentScript.resolveUrlRelativeTo('ZeroClipboard.swf');
|
||||
var trustedOrigins = [window.location.protocol + '//' + window.location.host];
|
||||
|
||||
ZeroClipboard.setDefaults({
|
||||
moviePath: zeroClipboardUrl,
|
||||
allowScriptAccess: 'always',
|
||||
trustedDomains: trustedOrigins, // Deprecated in a future version in favor of trustedOrigins
|
||||
trustedOrigins: trustedOrigins
|
||||
});
|
||||
|
||||
// Limitation of ZeroClipboard/Flash => Requires that ZeroClipboard be global so that Flash can call back into it
|
||||
// @TODO Use webpack expose-loader on ZeroClipboard
|
||||
window.ZeroClipboard = module.exports = ZeroClipboard;
|
||||
9
src/lib/applicationGlobal.js
Normal file
@@ -0,0 +1,9 @@
|
||||
var packageInfo = require('package.json');
|
||||
|
||||
module.exports = function global() {
|
||||
// Initialize global namespace (package name) if necessary
|
||||
var packageKey = '_' + packageInfo.name + '_Globals';
|
||||
global[packageKey] = global[packageKey] || {};
|
||||
|
||||
return global[packageKey];
|
||||
};
|
||||
52
src/lib/array.js
Normal file
@@ -0,0 +1,52 @@
|
||||
// Only works on string arrays since it uses an object as a hash to check for uniqueness
|
||||
exports.unique = function(stringArray) {
|
||||
var hash = {},
|
||||
result = [];
|
||||
for (var i = 0; i < stringArray.length; ++i) {
|
||||
if (!hash.hasOwnProperty(stringArray[i])) {
|
||||
hash[stringArray[i]] = true;
|
||||
result.push(stringArray[i]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
exports.last = function(array) {
|
||||
return array[array.length - 1];
|
||||
};
|
||||
|
||||
// Array Remove - By John Resig (MIT Licensed)
|
||||
//
|
||||
// Remove the second item from the array
|
||||
// array.remove(1);
|
||||
// Remove the second-to-last item from the array
|
||||
// array.remove(-2);
|
||||
// Remove the second and third items from the array
|
||||
// array.remove(1,2);
|
||||
// Remove the last and second-to-last items from the array
|
||||
// array.remove(-2,-1);
|
||||
//
|
||||
exports.removeByRange = function(array, from, to) {
|
||||
var rest = array.slice((to || from) + 1 || array.length);
|
||||
array.length = from < 0 ? array.length + from : from;
|
||||
return array.push.apply(array, rest);
|
||||
};
|
||||
|
||||
// http://stackoverflow.com/a/3955096
|
||||
exports.removeByValue = function(array) {
|
||||
var what,
|
||||
a = arguments,
|
||||
L = a.length,
|
||||
ax;
|
||||
while (L && array.length) {
|
||||
what = a[--L];
|
||||
while ((ax = array.indexOf(what)) !== -1) {
|
||||
array.splice(ax, 1);
|
||||
}
|
||||
}
|
||||
return array;
|
||||
};
|
||||
|
||||
exports.clone = function(array) {
|
||||
return array.slice(0);
|
||||
};
|
||||
11
src/lib/browser/SimplifiedFile.js
Normal file
@@ -0,0 +1,11 @@
|
||||
var saveAs = require('vendor/FileSaver');
|
||||
|
||||
module.exports = function(filename, mimetype, content) {
|
||||
var self = this;
|
||||
var fileEntry = null;
|
||||
var blob = new Blob([content], { type: mimetype });
|
||||
|
||||
this.download = function() {
|
||||
var f = saveAs(blob, filename);
|
||||
};
|
||||
};
|
||||
80
src/lib/browser/applicationStorage.js
Normal file
@@ -0,0 +1,80 @@
|
||||
// Manages access to application storage in localStorage, stored by
|
||||
// serializing/deserializing between a JSON string and an {}
|
||||
//
|
||||
// var applicationStorage = getApplicationStorage("MyApplication");
|
||||
//
|
||||
// applicationStorage.set("hat", "cat");
|
||||
// applicationStorage.set("face", 3);
|
||||
//
|
||||
// var name = applicationStorage.get("hat");
|
||||
//
|
||||
// applicationStorage.use(function(storage) {
|
||||
// storage.face++;
|
||||
// storage.hat = "cat2";
|
||||
// // Saves back storage after use...
|
||||
// });
|
||||
//
|
||||
// Result:
|
||||
// localStorage["MyApplication.applicationStorage"] = {
|
||||
// hat: "cat2",
|
||||
// face: 4
|
||||
// }
|
||||
//
|
||||
// and
|
||||
//
|
||||
// name = "cat"
|
||||
|
||||
// @TODO In retrospect, this code doesn't make any sense...
|
||||
|
||||
var applicationUniqueKeyToInstancesMap = {};
|
||||
module.exports = function(applicationUniqueKey) {
|
||||
// Always return the same instance for the same applicationUniqueKey
|
||||
if (!applicationUniqueKeyToInstancesMap.hasOwnProperty(applicationUniqueKey))
|
||||
applicationUniqueKeyToInstancesMap[
|
||||
applicationUniqueKey
|
||||
] = new ApplicationStorage(applicationUniqueKey);
|
||||
|
||||
return applicationUniqueKeyToInstancesMap[applicationUniqueKey];
|
||||
};
|
||||
|
||||
var ApplicationStorage = function(applicationUniqueKey) {
|
||||
var localStorageKey = applicationUniqueKey + '.applicationStorage';
|
||||
var applicationStorage = null;
|
||||
|
||||
var saveToLocalStorage = function() {
|
||||
var applicationStorageAsJSON = JSON.stringify(applicationStorage);
|
||||
localStorage.setItem(localStorageKey, applicationStorageAsJSON);
|
||||
};
|
||||
|
||||
var initializeFromLocalStorage = function() {
|
||||
var applicationStorageAsJSON = localStorage.getItem(localStorageKey);
|
||||
if (applicationStorageAsJSON)
|
||||
applicationStorage = JSON.parse(applicationStorageAsJSON);
|
||||
|
||||
if (applicationStorage === null) applicationStorage = {};
|
||||
};
|
||||
|
||||
var getApplicationStorage = function() {
|
||||
if (applicationStorage === null) initializeFromLocalStorage();
|
||||
|
||||
return applicationStorage;
|
||||
};
|
||||
|
||||
this.get = function(property) {
|
||||
return getApplicationStorage()[property];
|
||||
};
|
||||
|
||||
this.set = function(property, value) {
|
||||
getApplicationStorage()[property] = value;
|
||||
saveToLocalStorage();
|
||||
};
|
||||
|
||||
this.use = function(user) {
|
||||
user(getApplicationStorage());
|
||||
saveToLocalStorage();
|
||||
};
|
||||
|
||||
this._getGetLocalStorageKey = function() {
|
||||
return localStorageKey;
|
||||
};
|
||||
};
|
||||
61
src/lib/browser/browserSupport.js
Normal file
@@ -0,0 +1,61 @@
|
||||
var css = require('lib/ui/css');
|
||||
|
||||
// @TODO Comb through project and see if we need more here ...
|
||||
var shouldBeDefinedAndNotNull = [
|
||||
localStorage,
|
||||
document.querySelector,
|
||||
document.documentElement,
|
||||
Array.prototype.forEach,
|
||||
Array.prototype.filter,
|
||||
Function.prototype.bind
|
||||
];
|
||||
|
||||
// Add properties whose objects may not be defined in older browsers
|
||||
if (typeof Node !== 'undefined')
|
||||
shouldBeDefinedAndNotNull.push(Node.ELEMENT_NODE);
|
||||
|
||||
var shouldBeDefined = [document.documentElement.nextElementSibling];
|
||||
|
||||
// Can't use Array.prototype.every since we're testing compatibility
|
||||
var meetsMinimumRequirements = true;
|
||||
for (
|
||||
var i = 0;
|
||||
meetsMinimumRequirements && i < shouldBeDefinedAndNotNull.length;
|
||||
i++
|
||||
) {
|
||||
meetsMinimumRequirements =
|
||||
typeof shouldBeDefinedAndNotNull[i] !== 'undefined' &&
|
||||
shouldBeDefinedAndNotNull[i] !== null;
|
||||
}
|
||||
for (var i = 0; meetsMinimumRequirements && i < shouldBeDefined.length; i++) {
|
||||
meetsMinimumRequirements = typeof shouldBeDefined[i] !== 'undefined';
|
||||
}
|
||||
|
||||
if (!meetsMinimumRequirements) {
|
||||
module.exports = {
|
||||
meetsMinimumRequirements: false,
|
||||
featuresWithFallbacks: {}
|
||||
};
|
||||
} else {
|
||||
var featuresWithFallbacks = {
|
||||
'file-system': function() {
|
||||
return new Blob();
|
||||
}
|
||||
};
|
||||
|
||||
// Add CSS classes to the document root to enable hiding/showing elements more conveniently from CSS
|
||||
var rootNode = document.documentElement;
|
||||
Object.keys(featuresWithFallbacks).forEach(function(feature) {
|
||||
var isFeatureSupported;
|
||||
try {
|
||||
isFeatureSupported = Boolean(featuresWithFallbacks[feature]());
|
||||
} catch (e) {}
|
||||
var prefix = isFeatureSupported === true ? '' : 'no-';
|
||||
css(rootNode).addClass(prefix + feature);
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
meetsMinimumRequirements: meetsMinimumRequirements,
|
||||
featuresWithFallbacks: featuresWithFallbacks
|
||||
};
|
||||
}
|
||||
65
src/lib/browser/dom.js
Normal file
@@ -0,0 +1,65 @@
|
||||
var css = require('lib/ui/css'),
|
||||
functional = require('lib/functional'),
|
||||
array = require('lib/array');
|
||||
|
||||
exports.onDocumentReady = function(callback) {
|
||||
if (document.readyState === 'complete') {
|
||||
setTimeout(callback); // Asynchronously call callback
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', callback);
|
||||
}
|
||||
};
|
||||
|
||||
exports.createDocumentFragmentFromHtml = function(html) {
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML = html;
|
||||
var fragment = document.createDocumentFragment();
|
||||
while (div.firstChild) {
|
||||
fragment.appendChild(div.firstChild); // Appending to the fragment removes from the div
|
||||
}
|
||||
return fragment;
|
||||
};
|
||||
|
||||
exports.isNode = function(object) {
|
||||
return object && typeof object.nodeType === 'number';
|
||||
};
|
||||
|
||||
exports.isElement = function(object) {
|
||||
return (
|
||||
exports.isNode(object) &&
|
||||
(object instanceof HTMLElement ||
|
||||
object.nodeType === Node.ELEMENT_NODE ||
|
||||
object.nodeType === Node.DOCUMENT_FRAGMENT_NODE)
|
||||
);
|
||||
};
|
||||
|
||||
exports.isTextNode = function(object) {
|
||||
return exports.isNode(object) && object.nodeType === Node.TEXT_NODE;
|
||||
};
|
||||
|
||||
exports.extractStringFromElement = function(selector) {
|
||||
var string = null;
|
||||
|
||||
var candidateElements = document.querySelectorAll(selector);
|
||||
var candidateElement = array.last(candidateElements);
|
||||
if (candidateElement) {
|
||||
if (typeof candidateElement.textContent === 'string') {
|
||||
string = candidateElement.textContent.trim();
|
||||
if (string.length === 0) string = null;
|
||||
}
|
||||
|
||||
if (string === null) {
|
||||
if (typeof candidateElement.value === 'string') {
|
||||
string = candidateElement.value.trim();
|
||||
if (string.length === 0) string = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!string && arguments.length > 1) {
|
||||
var rest = Array.prototype.slice.call(arguments, 1);
|
||||
return exports.extractStringFromElement(rest);
|
||||
} else {
|
||||
return string;
|
||||
}
|
||||
};
|
||||
17
src/lib/functional.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// Functional programming helpers.
|
||||
|
||||
// Only allows fn to be run once. On all subsequent runs, returns the same
|
||||
// value as the first time. Passes through function arguments but does not
|
||||
// re-run the function when different arguments are passed in.
|
||||
exports.memoize = function(fn) {
|
||||
var hasRun = false;
|
||||
var returnValue = null;
|
||||
return function() {
|
||||
if (!hasRun) {
|
||||
hasRun = true;
|
||||
returnValue = fn.apply(this, arguments);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
};
|
||||
3
src/lib/handlebars-helpers/toString.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = function(x) {
|
||||
return x === void 0 ? 'undefined' : x.toString();
|
||||
};
|
||||
26
src/lib/mapSourceObjectOntoSinkObject.js
Normal file
@@ -0,0 +1,26 @@
|
||||
var objectPath = require('object-path');
|
||||
var array = require('lib/array');
|
||||
|
||||
module.exports = function mapSourceObjectOntoSinkObject(source, sink) {
|
||||
var schema = sink.constructor.schema;
|
||||
var unmappedRequiredFields = array.clone(schema.requiredFields);
|
||||
|
||||
var fields = schema.requiredFields.concat(schema.optionalFields);
|
||||
|
||||
fields.forEach(function(key) {
|
||||
var value = objectPath.get(source, key);
|
||||
|
||||
if (value !== undefined) {
|
||||
objectPath.set(sink, key, value);
|
||||
array.removeByValue(unmappedRequiredFields, key);
|
||||
} else if (key in schema.requiredFields) {
|
||||
throw new Error("Could not find required field '" + key + "' in object.");
|
||||
}
|
||||
});
|
||||
|
||||
if (unmappedRequiredFields.length > 0)
|
||||
throw new Error(
|
||||
'The following required fields not found in the source object: ' +
|
||||
unmappedRequiredFields.join(', ')
|
||||
);
|
||||
};
|
||||
6
src/lib/polyfills.js
Normal file
@@ -0,0 +1,6 @@
|
||||
// Needed by CSSselect
|
||||
if (!String.prototype.trimLeft) {
|
||||
String.prototype.trimLeft = function() {
|
||||
return this.replace(/^\s+/, '');
|
||||
};
|
||||
}
|
||||
24
src/lib/rollbar.js
Normal file
@@ -0,0 +1,24 @@
|
||||
var rollbar;
|
||||
|
||||
if (DEBUG) {
|
||||
var noop = function() {};
|
||||
rollbar = {
|
||||
critical: noop,
|
||||
error: noop,
|
||||
warning: noop,
|
||||
info: noop,
|
||||
debug: noop
|
||||
};
|
||||
} else {
|
||||
var rollbarConfig = require('lib/rollbarConfig');
|
||||
rollbar = require('expose?rollbar!vendor/rollbar.require.js');
|
||||
|
||||
var applicationGlobal = require('lib/applicationGlobal');
|
||||
// @TODO Duplicated btwn here and index.js, refactor out
|
||||
if (!applicationGlobal.rollbarInitialized) {
|
||||
rollbar.init(rollbarConfig);
|
||||
applicationGlobal.rollbarInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = rollbar;
|
||||
30
src/lib/rollbarConfig.js
Normal file
@@ -0,0 +1,30 @@
|
||||
var packageInfo = require('package.json');
|
||||
var rollbar = require('rollbar.json');
|
||||
var amazonScraper = require('excisor/amazonScraper');
|
||||
var environment = require('excisor/environment');
|
||||
|
||||
var _rollbarConfig = {
|
||||
accessToken: rollbar.client_access_token,
|
||||
captureUncaught: true,
|
||||
payload: {
|
||||
environment: environment,
|
||||
client: {
|
||||
javascript: {
|
||||
source_map_enabled: true,
|
||||
code_version: packageInfo.version,
|
||||
guess_uncaught_frames: true
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// @TODO Ack, more excisor code in lib
|
||||
var user = amazonScraper.findUser();
|
||||
if (user) {
|
||||
_rollbarConfig.payload.person = {
|
||||
id: user.id,
|
||||
username: user.name
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = _rollbarConfig;
|
||||
39
src/lib/scrape.js
Normal file
@@ -0,0 +1,39 @@
|
||||
var Parser = require('htmlparser2').WritableStream,
|
||||
Cornet = require('cornet'),
|
||||
http = require('http'),
|
||||
hyperquest = require('hyperquest');
|
||||
|
||||
function scrape(url, setupHook) {
|
||||
// console.log('scraping: ' + url);
|
||||
var cornet = new Cornet();
|
||||
|
||||
if (setupHook) {
|
||||
setupHook(cornet);
|
||||
}
|
||||
|
||||
var req = hyperquest.get(url);
|
||||
|
||||
req.pipe(new Parser(cornet));
|
||||
|
||||
req.on('response', function(res) {
|
||||
var status = res.statusCode;
|
||||
if (status < 200 || status >= 300) {
|
||||
var err = Error(
|
||||
'Received status code ' +
|
||||
status +
|
||||
' ("' +
|
||||
http.STATUS_CODES[status] +
|
||||
'")'
|
||||
);
|
||||
req.emit('error', err);
|
||||
}
|
||||
});
|
||||
|
||||
req.on('error', function(err) {
|
||||
cornet.emit('error', err);
|
||||
});
|
||||
|
||||
return cornet;
|
||||
}
|
||||
|
||||
module.exports = scrape;
|
||||
11
src/lib/string.js
Normal file
@@ -0,0 +1,11 @@
|
||||
exports.startsWith = function(str, substr) {
|
||||
return str.indexOf(substr) === 0;
|
||||
};
|
||||
|
||||
exports.isWhitespace = function(str) {
|
||||
return /^\s*$/.test(str);
|
||||
};
|
||||
|
||||
exports.isNotEmpty = function(str) {
|
||||
return Boolean(str && !exports.isWhitespace(str));
|
||||
};
|
||||
3
src/lib/stub.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = function() {
|
||||
throw new Error('Not implemented.');
|
||||
};
|
||||
58
src/lib/stylesheets/ModalDialog.less
Normal file
@@ -0,0 +1,58 @@
|
||||
.bookcision-ModalDialog-fixedWrapper {
|
||||
background-color: rgba(0, 0, 0, 0.1); // gray out the rest of the page
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
text-align: center;
|
||||
z-index: 5000; /* High, but lower than feedback */
|
||||
}
|
||||
|
||||
.bookcision-ModalDialog-containerElement {
|
||||
background-color: white;
|
||||
|
||||
margin: auto;
|
||||
width: 850px;
|
||||
height: 100%;
|
||||
|
||||
padding: 30px;
|
||||
box-sizing: border-box; // Make it so that the padding & border are included in
|
||||
// the width and height instead of being added to it; so
|
||||
// that we don't go over 100% width/height.
|
||||
|
||||
overflow: auto;
|
||||
|
||||
text-align: left;
|
||||
font-family: Georgia, "Times New Roman", Times, serif;
|
||||
|
||||
position: relative; // Must be positioned to become offsetParent of
|
||||
// closeButton; so that can be positioned absolutely
|
||||
// relative to this container element
|
||||
}
|
||||
|
||||
.bookcision-ModalDialog-containerElement,
|
||||
.bookcision-ModalDialog-containerElement ul {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.bookcision-ModalDialog-closeButton {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin-right: 10px;
|
||||
font-size: 4em;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.bookcision-ModalDialog-closeButton:hover {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.bookcision-ModalDialog-containerElement ul, .bookcision-ModalDialog-containerElement li {
|
||||
list-style-type: none !important;
|
||||
}
|
||||
107
src/lib/stylesheets/bootstrap-progress-bars.less
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
//
|
||||
// Progress bars
|
||||
// --------------------------------------------------
|
||||
|
||||
// ANIMATIONS
|
||||
// ----------
|
||||
|
||||
// Webkit
|
||||
@-webkit-keyframes progress-bar-stripes {
|
||||
from {
|
||||
background-position: 40px 0;
|
||||
}
|
||||
to {
|
||||
background-position: 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Firefox
|
||||
@-moz-keyframes progress-bar-stripes {
|
||||
from {
|
||||
background-position: 40px 0;
|
||||
}
|
||||
to {
|
||||
background-position: 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
// IE9
|
||||
@-ms-keyframes progress-bar-stripes {
|
||||
from {
|
||||
background-position: 40px 0;
|
||||
}
|
||||
to {
|
||||
background-position: 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Opera
|
||||
@-o-keyframes progress-bar-stripes {
|
||||
from {
|
||||
background-position: 0 0;
|
||||
}
|
||||
to {
|
||||
background-position: 40px 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Spec
|
||||
@keyframes progress-bar-stripes {
|
||||
from {
|
||||
background-position: 40px 0;
|
||||
}
|
||||
to {
|
||||
background-position: 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
// THE BARS
|
||||
// --------
|
||||
|
||||
// Outer container
|
||||
.progress {
|
||||
overflow: hidden;
|
||||
height: @baseLineHeight;
|
||||
.box-shadow(inset 0 1px 2px rgba(0,0,0,.1));
|
||||
.border-radius(@baseBorderRadius);
|
||||
}
|
||||
|
||||
// Bar of progress
|
||||
.progress .bar {
|
||||
width: 0%;
|
||||
height: 100%;
|
||||
color: @white;
|
||||
float: left;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
|
||||
.box-shadow(inset 0 -1px 0 rgba(0,0,0,.15));
|
||||
.box-sizing(border-box);
|
||||
.transition(width .6s ease);
|
||||
}
|
||||
.progress .bar + .bar {
|
||||
.box-shadow(~"inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15)");
|
||||
}
|
||||
|
||||
// Striped bars
|
||||
.progress-striped .bar {
|
||||
#gradient > .striped(#149bdf);
|
||||
.background-size(40px 40px);
|
||||
}
|
||||
|
||||
// Call animation for the active one
|
||||
.progress.active .bar {
|
||||
-webkit-animation: progress-bar-stripes 2s linear infinite;
|
||||
-moz-animation: progress-bar-stripes 2s linear infinite;
|
||||
-ms-animation: progress-bar-stripes 2s linear infinite;
|
||||
-o-animation: progress-bar-stripes 2s linear infinite;
|
||||
animation: progress-bar-stripes 2s linear infinite;
|
||||
}
|
||||
|
||||
// COLORS
|
||||
// ------
|
||||
|
||||
// Dull (gray)
|
||||
.progress-dull.progress-striped .bar, .progress-striped .bar-dull {
|
||||
#gradient > .striped(#8d8d8d);
|
||||
}
|
||||
54
src/lib/stylesheets/bootstrap.less
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/*!
|
||||
* Bootstrap v2.3.1
|
||||
*
|
||||
* Copyright 2012 Twitter, Inc
|
||||
* Licensed under the Apache License v2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Designed and built with all the love in the world @twitter by @mdo and @fat.
|
||||
*
|
||||
*/
|
||||
|
||||
// This forces us to wrap any html in this project (that wants to make use of
|
||||
// bootstrap's CSS) in an element with the 'bootstrap' tag. This keeps
|
||||
// bootstrap's CSS contained to the bookmarklet... we wouldn't want to
|
||||
// radically alter Amazon's CSS.
|
||||
.bootstrap {
|
||||
// --------------------------------------------------
|
||||
// Include bootstrap
|
||||
// --------------------------------------------------
|
||||
|
||||
// Core variables and mixins
|
||||
@import "../../vendor/bootstrap-2.3.1/less/variables.less"; // Modify this for custom colors, font-sizes, etc
|
||||
@import "../../vendor/bootstrap-2.3.1/less/mixins.less";
|
||||
|
||||
// CSS Reset
|
||||
@import "../../vendor/bootstrap-2.3.1/less/reset.less";
|
||||
|
||||
// To enable bootstrap buttons which are used for the "Download" button
|
||||
@baseLineHeight: 20px;
|
||||
@baseBorderRadius: 4px;
|
||||
// @import "../../vendor/bootstrap-2.3.1/less/forms.less";
|
||||
@import "../../vendor/bootstrap-2.3.1/less/buttons.less";
|
||||
@import "../../vendor/bootstrap-2.3.1/less/button-groups.less";
|
||||
// @import "../../vendor/bootstrap-2.3.1/less/popovers.less";
|
||||
@import "../../vendor/bootstrap-2.3.1/less/dropdowns.less";
|
||||
|
||||
// --------------------------------------------------
|
||||
// Declare any overrides
|
||||
// --------------------------------------------------
|
||||
|
||||
// We nest again b/c the line-height override below is setting the line-height on the button above. @TODO Investigate!
|
||||
.bookcision-feedback-containerElement {
|
||||
// To enable bootstrap progress bar which is used for the feedback UI
|
||||
@baseLineHeight: 10px;
|
||||
@baseBorderRadius: 0px;
|
||||
@import "bootstrap-progress-bars.less";
|
||||
}
|
||||
|
||||
// Work around https://github.com/zeroclipboard/ZeroClipboard/issues/237
|
||||
.btn {
|
||||
position: relative;
|
||||
z-index: 7500; /* Higher than modal dialog, lower than feedback */
|
||||
}
|
||||
}
|
||||
36
src/lib/stylesheets/feedback.less
Normal file
@@ -0,0 +1,36 @@
|
||||
.bookcision-feedback-fixedWrapper {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
z-index: 10000; /* Higher than modal dialog */
|
||||
}
|
||||
|
||||
.bookcision-feedback-containerElement {
|
||||
border-radius: 0 0 10px 10px;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
margin: 0 auto;
|
||||
top: 0;
|
||||
min-width: 450px;
|
||||
color: white;
|
||||
text-align: center;
|
||||
font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, Sans-Serif;
|
||||
font-size: 1.5em;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.bookcision-feedback-messagesContainerElement {
|
||||
margin: 0;
|
||||
padding: 0.3em 2em 1em;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.bookcision-feedback-messagesContainerElement ul,
|
||||
.bookcision-feedback-messagesContainerElement li {
|
||||
list-style-type: none !important;
|
||||
}
|
||||
|
||||
.bookcision-feedback-messagesContainerElement li:first-child {
|
||||
color: white;
|
||||
}
|
||||
37
src/lib/stylesheets/font-awesome.less
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/*!
|
||||
* Font Awesome 3.2.1
|
||||
* the iconic font designed for Bootstrap
|
||||
* ------------------------------------------------------------------------------
|
||||
* The full suite of pictographic icons, examples, and documentation can be
|
||||
* found at http://fontawesome.io. Stay up to date on Twitter at
|
||||
* http://twitter.com/fontawesome.
|
||||
*
|
||||
* License
|
||||
* ------------------------------------------------------------------------------
|
||||
* - The Font Awesome font is licensed under SIL OFL 1.1 -
|
||||
* http://scripts.sil.org/OFL
|
||||
* - Font Awesome CSS, LESS, and SASS files are licensed under MIT License -
|
||||
* http://opensource.org/licenses/mit-license.html
|
||||
* - Font Awesome documentation licensed under CC BY 3.0 -
|
||||
* http://creativecommons.org/licenses/by/3.0/
|
||||
* - Attribution is no longer required in Font Awesome 3.0, but much appreciated:
|
||||
* "Font Awesome by Dave Gandy - http://fontawesome.io"
|
||||
*
|
||||
* Author - Dave Gandy
|
||||
* ------------------------------------------------------------------------------
|
||||
* Email: dave@fontawesome.io
|
||||
* Twitter: http://twitter.com/davegandy
|
||||
* Work: Lead Product Designer @ Kyruus - http://kyruus.com
|
||||
*/
|
||||
|
||||
@import "../../vendor/font-awesome-3.2.1/less/variables.less";
|
||||
|
||||
// Excisor overrides
|
||||
@FontAwesomePath: "//netdna.bootstrapcdn.com/font-awesome/3.2.1/font"; // for referencing Bootstrap CDN font files directly
|
||||
|
||||
@import "../../vendor/font-awesome-3.2.1/less/mixins.less";
|
||||
@import "../../vendor/font-awesome-3.2.1/less/path.less";
|
||||
@import "../../vendor/font-awesome-3.2.1/less/core.less";
|
||||
// @import "../../vendor/font-awesome-3.2.1/less/bootstrap.less";
|
||||
// @import "../../vendor/font-awesome-3.2.1/less/extras.less";
|
||||
@import "../../vendor/font-awesome-3.2.1/less/icons.less";
|
||||
98
src/lib/ui/components/Button.js
Normal file
@@ -0,0 +1,98 @@
|
||||
var css = require('lib/ui/css');
|
||||
var dom = require('lib/browser/dom');
|
||||
|
||||
// Requires an element with the following HTML structure be passed in:
|
||||
// button.btn
|
||||
// [i.icon-ok]
|
||||
// | Button Text
|
||||
function Button(element) {
|
||||
// // @TODO Support passing in the parent div of the button for button groups?
|
||||
// if (element.nodeName === "div" && element.firstChild.nodeName === "button")
|
||||
// element = element.firstChild;
|
||||
|
||||
this._element = element;
|
||||
if (!dom.isElement(this._element))
|
||||
throw new Error('Argument is not an HTMLElement.');
|
||||
|
||||
this._icon = this._element.querySelector('i');
|
||||
|
||||
this._textElement = this._element.lastChild;
|
||||
if (!dom.isTextNode(this._textElement))
|
||||
throw new Error('The last element in the button must be a text node.');
|
||||
|
||||
this._runningFlashAnimations = false;
|
||||
}
|
||||
|
||||
Button.prototype.setText = function(newText) {
|
||||
if (this._textElement !== this._element.lastChild)
|
||||
throw new Error('Unexpected DOM structure in button.');
|
||||
|
||||
var newTextNode = document.createTextNode(newText);
|
||||
this._element.replaceChild(newTextNode, this._textElement);
|
||||
this._textElement = this._element.lastChild;
|
||||
};
|
||||
|
||||
Button.prototype.getText = function() {
|
||||
return this._textElement.nodeValue;
|
||||
};
|
||||
|
||||
Button.prototype.setIcon = function(className) {
|
||||
this._icon.className = className;
|
||||
};
|
||||
|
||||
Button.prototype.getIcon = function() {
|
||||
return this._icon.className;
|
||||
};
|
||||
|
||||
Button.prototype.flash = function(options) {
|
||||
if (options.icon && !dom.isElement(this._icon))
|
||||
throw new Error(
|
||||
'Invalid option for this button, which does not contain an icon.'
|
||||
);
|
||||
|
||||
if (!this._runningFlashAnimations) {
|
||||
this._runningFlashAnimations = true;
|
||||
|
||||
var originalIconClass = this.getIcon();
|
||||
var originalText = this.getText();
|
||||
|
||||
var switchToTemporaryIconAndText = function() {
|
||||
// Swap out icon and text WITHOUT css transition
|
||||
if (options.icon) {
|
||||
this.setIcon(options.icon);
|
||||
}
|
||||
|
||||
if (options.text) {
|
||||
var newText = originalText[0] === ' '
|
||||
? ' ' + options.text
|
||||
: options.text;
|
||||
this.setText(newText);
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
var switchBackToOriginalIcon = function(onCompleteCallback) {
|
||||
// Then swap back in the original copy icon and text
|
||||
this.setIcon(originalIconClass);
|
||||
this.setText(originalText);
|
||||
|
||||
// And fade in the original icon with css transition
|
||||
css(this._icon).fadeIn(100, onCompleteCallback);
|
||||
}.bind(this);
|
||||
|
||||
var resetRunningFlashAnimations = function() {
|
||||
this._runningFlashAnimations = false;
|
||||
}.bind(this);
|
||||
|
||||
var switchBackToOriginalIconAndReset = function() {
|
||||
// Fade out with css transition then do the switch
|
||||
css(this._icon).fadeOut(100, function() {
|
||||
switchBackToOriginalIcon(resetRunningFlashAnimations);
|
||||
});
|
||||
}.bind(this);
|
||||
|
||||
switchToTemporaryIconAndText();
|
||||
setTimeout(switchBackToOriginalIconAndReset, 3000);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = Button;
|
||||
61
src/lib/ui/components/ClipboardButton.js
Normal file
@@ -0,0 +1,61 @@
|
||||
var util = require('util'),
|
||||
css = require('lib/ui/css'),
|
||||
Button = require('lib/ui/components/Button'),
|
||||
ZeroClipboard = require('lib/ZeroClipboardWrapper');
|
||||
|
||||
function ClipboardButton(element, clipboardContent, callbacks) {
|
||||
Button.call(this, element);
|
||||
|
||||
var bootstrapButtonClasses = {
|
||||
hoverClass: 'hover',
|
||||
activeClass: 'active'
|
||||
};
|
||||
var clipboard = new ZeroClipboard(this._element, bootstrapButtonClasses);
|
||||
var buttonElement = this._element;
|
||||
|
||||
var provideErrorMessageOnClipboardCopyAttempt = (function() {
|
||||
// @TODO Find a function utility in npm with a .once() function (or write one)
|
||||
var setOnce = false; // Make sure it only runs once, as it appears ZeroClipboard fires both the
|
||||
// noflash and wrongflash events in the case of there being no Flash Player,
|
||||
// and we don't want to bind two alerts to the button.
|
||||
|
||||
return function(message) {
|
||||
if (!setOnce) {
|
||||
setOnce = true;
|
||||
clipboard.unglue(buttonElement);
|
||||
buttonElement.addEventListener('click', function() {
|
||||
alert(message);
|
||||
});
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
// With ZeroClipboard, you can only have one handler per event, and
|
||||
// first handler wins, so register all passed-in handlers first to
|
||||
// allow them to take precedence.
|
||||
for (var callbackName in callbacks) {
|
||||
clipboard.on(callbackName, callbacks[callbackName]);
|
||||
}
|
||||
|
||||
clipboard.on('load', function(client) {
|
||||
clipboard.on('dataRequested', function(client, args) {
|
||||
client.setText(clipboardContent);
|
||||
});
|
||||
});
|
||||
|
||||
clipboard.on('noflash', function(client, args) {
|
||||
provideErrorMessageOnClipboardCopyAttempt(
|
||||
'You must have Flash Player installed to copy to the clipboard.'
|
||||
);
|
||||
});
|
||||
|
||||
clipboard.on('wrongflash', function(client, args) {
|
||||
provideErrorMessageOnClipboardCopyAttempt(
|
||||
'You must upgrade your Flash Player to copy to the clipboard.'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
util.inherits(ClipboardButton, Button);
|
||||
|
||||
module.exports = ClipboardButton;
|
||||
132
src/lib/ui/components/ModalDialog.js
Normal file
@@ -0,0 +1,132 @@
|
||||
// ModalDialog - Creates a generic modal dialog on the page and allows the caller to fill in the content
|
||||
|
||||
var css = require('lib/ui/css');
|
||||
var dom = require('lib/browser/dom');
|
||||
var move = require('vendor/move');
|
||||
var key = require('key');
|
||||
|
||||
require('lib/stylesheets/ModalDialog.less');
|
||||
|
||||
var currentModalDialog = null;
|
||||
|
||||
module.exports = function(nodeOrHtml) {
|
||||
if (currentModalDialog !== null)
|
||||
throw new Error('Can only create one modal dialog at a time.');
|
||||
|
||||
currentModalDialog = this;
|
||||
var moveDuration = '0.15s'; // @TODO Move
|
||||
var containerElement = null;
|
||||
var fixedWrapper = null;
|
||||
|
||||
var addToDOM = function() {
|
||||
document.body.appendChild(fixedWrapper);
|
||||
};
|
||||
|
||||
var removeFromDOM = function() {
|
||||
document.body.removeChild(fixedWrapper);
|
||||
fixedWrapper = null;
|
||||
containerElement = null;
|
||||
|
||||
currentModalDialog = null; // Allow creating another modal dialog now that this one is gone.
|
||||
};
|
||||
|
||||
var createElementsAndAddToDOM = function() {
|
||||
fixedWrapper = document.createElement('div');
|
||||
css(fixedWrapper)
|
||||
.addClass('bootstrap')
|
||||
.addClass('bookcision-ModalDialog-fixedWrapper');
|
||||
|
||||
containerElement = document.createElement('div');
|
||||
css(containerElement).addClass('bookcision-ModalDialog-containerElement');
|
||||
|
||||
fixedWrapper.appendChild(containerElement);
|
||||
|
||||
var closeButton = document.createElement('span');
|
||||
css(closeButton).addClass('bookcision-ModalDialog-closeButton');
|
||||
closeButton.innerHTML = '×'; // @Move to CSS?
|
||||
|
||||
containerElement.appendChild(closeButton);
|
||||
|
||||
// if the user clicks outside of the container element or clicks the close button, hide it
|
||||
fixedWrapper.addEventListener('click', function(clickEvent) {
|
||||
if (
|
||||
fixedWrapper === clickEvent.target ||
|
||||
closeButton.contains(clickEvent.target)
|
||||
)
|
||||
hideModalDialog();
|
||||
});
|
||||
|
||||
addToDOM();
|
||||
|
||||
// Make sure text never runs into close button (have to do after adding to
|
||||
// DOM so that closeButton.offsetWidth has a value)
|
||||
var totalCloseButtonWidthWithPaddingAndMargin =
|
||||
css(closeButton).getUsedValue('marginRight') + closeButton.offsetWidth;
|
||||
css(containerElement).apply(
|
||||
'padding-right',
|
||||
totalCloseButtonWidthWithPaddingAndMargin
|
||||
);
|
||||
|
||||
showModalDialog();
|
||||
};
|
||||
|
||||
var hideModalDialog = function() {
|
||||
window.removeEventListener('keyup', hideModalDialogIfEscapePressed);
|
||||
|
||||
var resetPositionAndHide = function() {
|
||||
if (!fixedWrapper) return; // fixedWrapper can be removed from DOM before move.js callback
|
||||
|
||||
// Hide the element and then instantly reset the opacity
|
||||
fixedWrapper.style.display = 'none';
|
||||
fixedWrapper.style.opacity = '1';
|
||||
removeFromDOM();
|
||||
};
|
||||
|
||||
// Fade-out animation
|
||||
move(fixedWrapper)
|
||||
.set('opacity', '0')
|
||||
.duration(moveDuration)
|
||||
.then(resetPositionAndHide)
|
||||
.end();
|
||||
};
|
||||
|
||||
var showModalDialog = function() {
|
||||
window.addEventListener('keyup', hideModalDialogIfEscapePressed);
|
||||
|
||||
fixedWrapper.style.display = 'inline-block';
|
||||
fixedWrapper.style.opacity = '0';
|
||||
|
||||
// Force browser to calculate styles on new DOM element listItem so that CSS3 transition below
|
||||
// can be applied (see http://stackoverflow.com/questions/3969817/css3-transitions-to-dynamically-created-elements)
|
||||
css(fixedWrapper).getUsedValue('opacity');
|
||||
|
||||
// Fade-in animation
|
||||
move(fixedWrapper).set('opacity', '1').duration(moveDuration).end();
|
||||
};
|
||||
|
||||
var hideModalDialogIfEscapePressed = function(evt) {
|
||||
if (key.is(key.code.special.esc, evt.which)) {
|
||||
hideModalDialog();
|
||||
}
|
||||
};
|
||||
|
||||
this.appendChild = function(node) {
|
||||
containerElement.appendChild(node);
|
||||
};
|
||||
|
||||
this.appendHTML = function(html) {
|
||||
containerElement.insertAdjacentHTML('beforeend', html);
|
||||
};
|
||||
|
||||
createElementsAndAddToDOM();
|
||||
|
||||
if (typeof nodeOrHtml !== 'undefined') {
|
||||
if (dom.isNode(nodeOrHtml)) {
|
||||
this.appendChild(nodeOrHtml);
|
||||
} else if (typeof nodeOrHtml === 'string') {
|
||||
this.appendHTML(nodeOrHtml);
|
||||
} else {
|
||||
throw 'Error: Cannot add object of unknown type to ModalDialog.';
|
||||
}
|
||||
}
|
||||
};
|
||||
234
src/lib/ui/components/feedback.js
Normal file
@@ -0,0 +1,234 @@
|
||||
// feedback - Console-like UI to show feedback to the user about progress and what is
|
||||
// happening with the bookmarklet during the loading/parsing/initialization phase
|
||||
|
||||
// @TODO Fix progress bars.
|
||||
|
||||
var css = require('lib/ui/css'); // @TODO Do we still need this module in this file? In the project?
|
||||
var LimitedLengthQueue = require('lib/LimitedLengthQueue');
|
||||
var move = require('vendor/move');
|
||||
|
||||
require('lib/stylesheets/bootstrap.less');
|
||||
require('lib/stylesheets/feedback.less');
|
||||
|
||||
// @TODO Hook up to UI events.
|
||||
// @TODO Leave the UI up on the screen while the user is moused over.
|
||||
// @TODO Make re-use existing DOM elements if they already exist on page (e.g. after reloading bookmarklet js).
|
||||
|
||||
module.exports = (function() {
|
||||
var moveDuration = '0.15s'; // @TODO Move this to move.defaults = { duration: X } once move is scoped to just this code
|
||||
var secondsBeforeHidingUI = 2;
|
||||
|
||||
var fixedWrapper = null;
|
||||
var containerElement = null;
|
||||
var messagesContainerElement = null;
|
||||
var maxMessagesToDisplay = 3;
|
||||
var messagesForUser = new LimitedLengthQueue(maxMessagesToDisplay);
|
||||
|
||||
var progressBar = null;
|
||||
var progressBarContainer = null;
|
||||
var progressBarPercent = null;
|
||||
|
||||
var addToDOM = function() {
|
||||
document.body.appendChild(fixedWrapper);
|
||||
};
|
||||
|
||||
var removeFromDOM = function() {
|
||||
document.body.removeChild(fixedWrapper);
|
||||
fixedWrapper = null;
|
||||
containerElement = null;
|
||||
};
|
||||
|
||||
var createElementsIfNecessary = function() {
|
||||
// Create the container if necessary
|
||||
if (!fixedWrapper) {
|
||||
fixedWrapper = document.createElement('div');
|
||||
css(fixedWrapper)
|
||||
.addClass('bootstrap')
|
||||
.addClass('bookcision-feedback-fixedWrapper');
|
||||
|
||||
containerElement = document.createElement('div');
|
||||
css(containerElement).addClass('bookcision-feedback-containerElement');
|
||||
|
||||
progressBarContainer = document.createElement('div');
|
||||
css(progressBarContainer)
|
||||
.addClass('progress')
|
||||
.addClass('progress-dull')
|
||||
.addClass('progress-striped');
|
||||
progressBar = document.createElement('div');
|
||||
css(progressBar).addClass('bar');
|
||||
progressBarContainer.appendChild(progressBar);
|
||||
containerElement.appendChild(progressBarContainer);
|
||||
hideProgressBar();
|
||||
|
||||
messagesContainerElement = document.createElement('ul');
|
||||
css(messagesContainerElement).addClass(
|
||||
'bookcision-feedback-messagesContainerElement'
|
||||
);
|
||||
containerElement.appendChild(messagesContainerElement);
|
||||
|
||||
fixedWrapper.appendChild(containerElement);
|
||||
|
||||
// if the user clicks outside of the container element, hide it
|
||||
fixedWrapper.addEventListener('click', function(clickEvent) {
|
||||
if (!containerElement.contains(clickEvent.target))
|
||||
hideContainerElement();
|
||||
});
|
||||
|
||||
addToDOM();
|
||||
}
|
||||
|
||||
showContainerElement();
|
||||
};
|
||||
|
||||
var hideContainerElement = function() {
|
||||
clearFeedbackTimeoutCheck();
|
||||
|
||||
var resetPositionAndHide = function() {
|
||||
if (!containerElement) return; // containerElement can be removed from DOM before move.js callback
|
||||
|
||||
// Hide the element and then instantly move it back to the original position
|
||||
containerElement.style.display = 'none';
|
||||
move(containerElement).y(0).duration('0s').end();
|
||||
|
||||
removeFromDOM();
|
||||
|
||||
removeAllMessages();
|
||||
};
|
||||
|
||||
// Slide-up animation
|
||||
move(containerElement)
|
||||
.y(containerElement.offsetHeight * -1)
|
||||
.duration(moveDuration)
|
||||
.then(resetPositionAndHide)
|
||||
.end();
|
||||
};
|
||||
|
||||
var showContainerElement = function() {
|
||||
containerElement.style.display = 'inline-block';
|
||||
};
|
||||
|
||||
var removeAllMessages = function() {
|
||||
while (messagesContainerElement.hasChildNodes())
|
||||
messagesContainerElement.removeChild(messagesContainerElement.lastChild);
|
||||
|
||||
messagesForUser.empty(); // @TODO Keeping the DOM and this queue in sync is currently all manual. Fix.
|
||||
};
|
||||
|
||||
var hideProgressBar = function() {
|
||||
progressBarPercent = null;
|
||||
progressBarContainer.style.display = 'none';
|
||||
};
|
||||
var showProgressBar = function(percent) {
|
||||
if (percent < 0 || percent > 100)
|
||||
throw new Error(
|
||||
'Progress bar width must be between 0 and 100, inclusive'
|
||||
);
|
||||
|
||||
progressBarPercent = percent;
|
||||
progressBar.style.width = String(progressBarPercent) + '%';
|
||||
|
||||
if (progressBarPercent < 100) css(progressBarContainer).addClass('active');
|
||||
else css(progressBarContainer).removeClass('active');
|
||||
|
||||
progressBarContainer.style.display = '';
|
||||
};
|
||||
|
||||
var timeoutID = null;
|
||||
var clearFeedbackTimeoutCheck = function() {
|
||||
if (timeoutID) {
|
||||
clearTimeout(timeoutID);
|
||||
timeoutID = null;
|
||||
}
|
||||
};
|
||||
var setupFeedbackTimeoutCheck = function() {
|
||||
clearFeedbackTimeoutCheck();
|
||||
|
||||
if (progressBarPercent === null || progressBarPercent === 100) {
|
||||
timeoutID = setTimeout(
|
||||
hideContainerElement,
|
||||
secondsBeforeHidingUI * 1000
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
var addText = function(text, displayProgressBarPercent) {
|
||||
if (displayProgressBarPercent) {
|
||||
showProgressBar(displayProgressBarPercent);
|
||||
} else {
|
||||
hideProgressBar();
|
||||
}
|
||||
|
||||
var listItem = document.createElement('li');
|
||||
listItem.style.fontSize = '0.4em'; // @TODO Re-evaluate all em values after understanding em better
|
||||
listItem.style.opacity = '0';
|
||||
|
||||
var messageToRemove = messagesForUser.unshift(listItem);
|
||||
if (messageToRemove) {
|
||||
// Fade out the last element and then remove it from the DOM
|
||||
move(messageToRemove)
|
||||
.set('font-size', '0em')
|
||||
.set('opacity', '0')
|
||||
.duration(moveDuration)
|
||||
.end(function() {
|
||||
if (messagesContainerElement.contains(messageToRemove))
|
||||
messagesContainerElement.removeChild(messageToRemove);
|
||||
});
|
||||
}
|
||||
|
||||
// Add the text as a text node
|
||||
var textNode = document.createTextNode(text);
|
||||
listItem.appendChild(textNode);
|
||||
|
||||
// Insert the list item into the DOM
|
||||
listItem.style.margin = 0;
|
||||
messagesContainerElement.insertBefore(
|
||||
listItem,
|
||||
messagesContainerElement.firstElementChild
|
||||
);
|
||||
|
||||
// Force browser to calculate styles on new DOM element listItem so that CSS3 transition below
|
||||
// can be applied (see http://stackoverflow.com/questions/3969817/css3-transitions-to-dynamically-created-elements)
|
||||
css(listItem).getUsedValue('opacity');
|
||||
|
||||
// Set all the styles
|
||||
var children = Array.prototype.slice.call(
|
||||
messagesContainerElement.children
|
||||
);
|
||||
children.forEach(function(child, index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
move(child)
|
||||
.set('font-size', '2.5em')
|
||||
.set('opacity', '1')
|
||||
.duration(moveDuration)
|
||||
.end();
|
||||
break;
|
||||
case 1:
|
||||
move(child)
|
||||
.set('font-size', '1.5em')
|
||||
.set('color', 'rgba(255, 255, 255, .5)')
|
||||
.duration(moveDuration)
|
||||
.end();
|
||||
break;
|
||||
case 2:
|
||||
move(child)
|
||||
.set('font-size', '1.0em')
|
||||
.set('color', 'rgba(255, 255, 255, .3)')
|
||||
.duration(moveDuration)
|
||||
.end();
|
||||
break;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return function() {
|
||||
if (!document.body) {
|
||||
throw 'Error: DOM is not loaded yet.';
|
||||
}
|
||||
|
||||
createElementsIfNecessary();
|
||||
addText.apply(this, arguments);
|
||||
setupFeedbackTimeoutCheck(); // @TODO convert this to be a callback on changing the message queue and
|
||||
// changing the progress bar percent.
|
||||
};
|
||||
})();
|
||||
111
src/lib/ui/css.js
Normal file
@@ -0,0 +1,111 @@
|
||||
var paramCase = require('param-case');
|
||||
var vibe = require('vibe');
|
||||
var fade = require('fade');
|
||||
|
||||
var propertySuffixes = {
|
||||
top: 'px',
|
||||
bottom: 'px',
|
||||
left: 'px',
|
||||
right: 'px',
|
||||
width: 'px',
|
||||
height: 'px',
|
||||
'font-size': 'px',
|
||||
margin: 'px',
|
||||
'margin-top': 'px',
|
||||
'margin-bottom': 'px',
|
||||
'margin-left': 'px',
|
||||
'margin-right': 'px',
|
||||
padding: 'px',
|
||||
'padding-top': 'px',
|
||||
'padding-bottom': 'px',
|
||||
'padding-left': 'px',
|
||||
'padding-right': 'px'
|
||||
};
|
||||
|
||||
// Helper functions
|
||||
|
||||
// Css class
|
||||
function Css(element) {
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
Css.prototype.apply = function() {
|
||||
var styles = null;
|
||||
|
||||
// Support single properties - apply(property, value)
|
||||
if (arguments.length === 2) {
|
||||
styles = {};
|
||||
styles[arguments[0]] = arguments[1];
|
||||
} else {
|
||||
// Support multiple properties - apply({property1:value1, property2:value2})
|
||||
styles = arguments[0];
|
||||
}
|
||||
|
||||
var cssStyleDeclaration = this.element.style;
|
||||
for (var property in styles) {
|
||||
if (styles.hasOwnProperty(property)) {
|
||||
var cssProperty = paramCase(property);
|
||||
var value = styles[property];
|
||||
|
||||
var cssValue;
|
||||
if (
|
||||
typeof value === 'number' &&
|
||||
propertySuffixes.hasOwnProperty(cssProperty)
|
||||
)
|
||||
cssValue = String(value) + propertySuffixes[cssProperty];
|
||||
else cssValue = value;
|
||||
|
||||
cssStyleDeclaration.setProperty(cssProperty, cssValue);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Css.prototype.getUsedValue = function(property) {
|
||||
var style = getComputedStyle(this.element);
|
||||
var value = style[property];
|
||||
if (value) {
|
||||
var valueAsFloat = parseFloat(value);
|
||||
return isNaN(valueAsFloat) ? value : valueAsFloat;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
Css.prototype.addClass = function(className) {
|
||||
vibe.addClass(this.element, className);
|
||||
return this;
|
||||
};
|
||||
|
||||
Css.prototype.removeClass = function(className) {
|
||||
vibe.removeClass(this.element, className);
|
||||
return this;
|
||||
};
|
||||
|
||||
Css.prototype.toggleClass = function(className) {
|
||||
vibe.toggleClass(this.element, className);
|
||||
return this;
|
||||
};
|
||||
|
||||
Css.prototype.hasClass = function(className) {
|
||||
return vibe.hasClass(this.element, className);
|
||||
};
|
||||
|
||||
(function() {
|
||||
var fadeInOrOut = function(inOrOutMethod) {
|
||||
return function(duration, callback) {
|
||||
fade[inOrOutMethod](this.element, duration);
|
||||
setTimeout(callback, duration);
|
||||
};
|
||||
};
|
||||
|
||||
Css.prototype.fadeOut = fadeInOrOut('out');
|
||||
|
||||
Css.prototype.fadeIn = fadeInOrOut('in');
|
||||
})();
|
||||
|
||||
// return convenience function for constructor
|
||||
module.exports = function(element) {
|
||||
return new Css(element);
|
||||
};
|
||||
28
src/lib/url.js
Normal file
@@ -0,0 +1,28 @@
|
||||
var util = require('util');
|
||||
var url = require('url');
|
||||
|
||||
var url = function() {};
|
||||
|
||||
url.getCurrentScriptUrl = function(scriptName) {
|
||||
var currentScript = url.getCurrentScript();
|
||||
return currentScript ? currentScript.src : null;
|
||||
};
|
||||
|
||||
// Will not work with script tags where the src attribute doesn't end with the script name, such as if
|
||||
// query parameters are used for cache-circumvention.
|
||||
url.getCurrentScript = (function() {
|
||||
var strictScriptSelector = util.format('script[src$="%s"]', scriptName);
|
||||
|
||||
return function(scriptName) {
|
||||
var script = null;
|
||||
|
||||
var matchingScripts = document.querySelectorAll(strictScriptSelector);
|
||||
if (matchingScripts.length > 0) {
|
||||
script = array.last(matchingScripts);
|
||||
}
|
||||
|
||||
return script;
|
||||
};
|
||||
})();
|
||||
|
||||
module.exports = url;
|
||||
10
src/lib/versionManager.js
Normal file
@@ -0,0 +1,10 @@
|
||||
// @TODO every module export should have a function that returns browser compatibility
|
||||
// so that these can be run elsewhere and action can be taken accordingly if the browser
|
||||
// is not compatible. E.g. this module relies on localStorage.
|
||||
|
||||
// @TODO Hook this up?
|
||||
|
||||
var versionManager = function(applicationUniqueKey, currentVersion) {
|
||||
var applicationStorage = new ApplicationStorage(applicationUniqueKey);
|
||||
var data = (localStorage[moduleName] = {});
|
||||
};
|
||||
241
src/vendor/FileSaver.js
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
/* FileSaver.js
|
||||
* A saveAs() FileSaver implementation.
|
||||
* 2014-05-27
|
||||
*
|
||||
* By Eli Grey, http://eligrey.com
|
||||
* License: X11/MIT
|
||||
* See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
/*global self */
|
||||
/*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */
|
||||
|
||||
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
|
||||
|
||||
var saveAs = saveAs
|
||||
// IE 10+ (native saveAs)
|
||||
|| (typeof navigator !== "undefined" &&
|
||||
navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigator))
|
||||
// Everyone else
|
||||
|| (function(view) {
|
||||
"use strict";
|
||||
// IE <10 is explicitly unsupported
|
||||
if (typeof navigator !== "undefined" &&
|
||||
/MSIE [1-9]\./.test(navigator.userAgent)) {
|
||||
return;
|
||||
}
|
||||
var
|
||||
doc = view.document
|
||||
// only get URL when necessary in case Blob.js hasn't overridden it yet
|
||||
, get_URL = function() {
|
||||
return view.URL || view.webkitURL || view;
|
||||
}
|
||||
, save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
|
||||
, can_use_save_link = !view.externalHost && "download" in save_link
|
||||
, click = function(node) {
|
||||
var event = doc.createEvent("MouseEvents");
|
||||
event.initMouseEvent(
|
||||
"click", true, false, view, 0, 0, 0, 0, 0
|
||||
, false, false, false, false, 0, null
|
||||
);
|
||||
node.dispatchEvent(event);
|
||||
}
|
||||
, webkit_req_fs = view.webkitRequestFileSystem
|
||||
, req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem
|
||||
, throw_outside = function(ex) {
|
||||
(view.setImmediate || view.setTimeout)(function() {
|
||||
throw ex;
|
||||
}, 0);
|
||||
}
|
||||
, force_saveable_type = "application/octet-stream"
|
||||
, fs_min_size = 0
|
||||
, deletion_queue = []
|
||||
, process_deletion_queue = function() {
|
||||
var i = deletion_queue.length;
|
||||
while (i--) {
|
||||
var file = deletion_queue[i];
|
||||
if (typeof file === "string") { // file is an object URL
|
||||
get_URL().revokeObjectURL(file);
|
||||
} else { // file is a File
|
||||
file.remove();
|
||||
}
|
||||
}
|
||||
deletion_queue.length = 0; // clear queue
|
||||
}
|
||||
, dispatch = function(filesaver, event_types, event) {
|
||||
event_types = [].concat(event_types);
|
||||
var i = event_types.length;
|
||||
while (i--) {
|
||||
var listener = filesaver["on" + event_types[i]];
|
||||
if (typeof listener === "function") {
|
||||
try {
|
||||
listener.call(filesaver, event || filesaver);
|
||||
} catch (ex) {
|
||||
throw_outside(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
, FileSaver = function(blob, name) {
|
||||
// First try a.download, then web filesystem, then object URLs
|
||||
var
|
||||
filesaver = this
|
||||
, type = blob.type
|
||||
, blob_changed = false
|
||||
, object_url
|
||||
, target_view
|
||||
, get_object_url = function() {
|
||||
var object_url = get_URL().createObjectURL(blob);
|
||||
deletion_queue.push(object_url);
|
||||
return object_url;
|
||||
}
|
||||
, dispatch_all = function() {
|
||||
dispatch(filesaver, "writestart progress write writeend".split(" "));
|
||||
}
|
||||
// on any filesys errors revert to saving with object URLs
|
||||
, fs_error = function() {
|
||||
// don't create more object URLs than needed
|
||||
if (blob_changed || !object_url) {
|
||||
object_url = get_object_url(blob);
|
||||
}
|
||||
if (target_view) {
|
||||
target_view.location.href = object_url;
|
||||
} else {
|
||||
window.open(object_url, "_blank");
|
||||
}
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch_all();
|
||||
}
|
||||
, abortable = function(func) {
|
||||
return function() {
|
||||
if (filesaver.readyState !== filesaver.DONE) {
|
||||
return func.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
, create_if_not_found = {create: true, exclusive: false}
|
||||
, slice
|
||||
;
|
||||
filesaver.readyState = filesaver.INIT;
|
||||
if (!name) {
|
||||
name = "download";
|
||||
}
|
||||
if (can_use_save_link) {
|
||||
object_url = get_object_url(blob);
|
||||
save_link.href = object_url;
|
||||
save_link.download = name;
|
||||
click(save_link);
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch_all();
|
||||
return;
|
||||
}
|
||||
// Object and web filesystem URLs have a problem saving in Google Chrome when
|
||||
// viewed in a tab, so I force save with application/octet-stream
|
||||
// http://code.google.com/p/chromium/issues/detail?id=91158
|
||||
if (view.chrome && type && type !== force_saveable_type) {
|
||||
slice = blob.slice || blob.webkitSlice;
|
||||
blob = slice.call(blob, 0, blob.size, force_saveable_type);
|
||||
blob_changed = true;
|
||||
}
|
||||
// Since I can't be sure that the guessed media type will trigger a download
|
||||
// in WebKit, I append .download to the filename.
|
||||
// https://bugs.webkit.org/show_bug.cgi?id=65440
|
||||
if (webkit_req_fs && name !== "download") {
|
||||
name += ".download";
|
||||
}
|
||||
if (type === force_saveable_type || webkit_req_fs) {
|
||||
target_view = view;
|
||||
}
|
||||
if (!req_fs) {
|
||||
fs_error();
|
||||
return;
|
||||
}
|
||||
fs_min_size += blob.size;
|
||||
req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) {
|
||||
fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) {
|
||||
var save = function() {
|
||||
dir.getFile(name, create_if_not_found, abortable(function(file) {
|
||||
file.createWriter(abortable(function(writer) {
|
||||
writer.onwriteend = function(event) {
|
||||
target_view.location.href = file.toURL();
|
||||
deletion_queue.push(file);
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch(filesaver, "writeend", event);
|
||||
};
|
||||
writer.onerror = function() {
|
||||
var error = writer.error;
|
||||
if (error.code !== error.ABORT_ERR) {
|
||||
fs_error();
|
||||
}
|
||||
};
|
||||
"writestart progress write abort".split(" ").forEach(function(event) {
|
||||
writer["on" + event] = filesaver["on" + event];
|
||||
});
|
||||
writer.write(blob);
|
||||
filesaver.abort = function() {
|
||||
writer.abort();
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
};
|
||||
filesaver.readyState = filesaver.WRITING;
|
||||
}), fs_error);
|
||||
}), fs_error);
|
||||
};
|
||||
dir.getFile(name, {create: false}, abortable(function(file) {
|
||||
// delete file if it already exists
|
||||
file.remove();
|
||||
save();
|
||||
}), abortable(function(ex) {
|
||||
if (ex.code === ex.NOT_FOUND_ERR) {
|
||||
save();
|
||||
} else {
|
||||
fs_error();
|
||||
}
|
||||
}));
|
||||
}), fs_error);
|
||||
}), fs_error);
|
||||
}
|
||||
, FS_proto = FileSaver.prototype
|
||||
, saveAs = function(blob, name) {
|
||||
return new FileSaver(blob, name);
|
||||
}
|
||||
;
|
||||
FS_proto.abort = function() {
|
||||
var filesaver = this;
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch(filesaver, "abort");
|
||||
};
|
||||
FS_proto.readyState = FS_proto.INIT = 0;
|
||||
FS_proto.WRITING = 1;
|
||||
FS_proto.DONE = 2;
|
||||
|
||||
FS_proto.error =
|
||||
FS_proto.onwritestart =
|
||||
FS_proto.onprogress =
|
||||
FS_proto.onwrite =
|
||||
FS_proto.onabort =
|
||||
FS_proto.onerror =
|
||||
FS_proto.onwriteend =
|
||||
null;
|
||||
|
||||
view.addEventListener("unload", process_deletion_queue, false);
|
||||
saveAs.unload = function() {
|
||||
process_deletion_queue();
|
||||
view.removeEventListener("unload", process_deletion_queue, false);
|
||||
};
|
||||
return saveAs;
|
||||
}(
|
||||
typeof self !== "undefined" && self
|
||||
|| typeof window !== "undefined" && window
|
||||
|| this.content
|
||||
));
|
||||
// `self` is undefined in Firefox for Android content script context
|
||||
// while `this` is nsIContentFrameMessageManager
|
||||
// with an attribute `content` that corresponds to the window
|
||||
|
||||
if (typeof module !== "undefined" && module !== null) {
|
||||
module.exports = saveAs;
|
||||
} else if ((typeof define !== "undefined" && define !== null) && (define.amd != null)) {
|
||||
define([], function() {
|
||||
return saveAs;
|
||||
});
|
||||
}
|
||||
37
src/vendor/bootstrap-2.3.1/.gitignore
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# Numerous always-ignore extensions
|
||||
*.diff
|
||||
*.err
|
||||
*.orig
|
||||
*.log
|
||||
*.rej
|
||||
*.swo
|
||||
*.swp
|
||||
*.zip
|
||||
*.vi
|
||||
*~
|
||||
*.sass-cache
|
||||
|
||||
# OS or Editor folders
|
||||
.DS_Store
|
||||
._*
|
||||
Thumbs.db
|
||||
.cache
|
||||
.project
|
||||
.settings
|
||||
.tmproj
|
||||
*.esproj
|
||||
nbproject
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
|
||||
# Komodo
|
||||
*.komodoproject
|
||||
.komodotools
|
||||
|
||||
# Folders to ignore
|
||||
.hg
|
||||
.svn
|
||||
.CVS
|
||||
.idea
|
||||
node_modules
|
||||
dist
|
||||
3
src/vendor/bootstrap-2.3.1/.travis.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.6
|
||||
360
src/vendor/bootstrap-2.3.1/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,360 @@
|
||||
## 2.3.1 (February 28, 2013)
|
||||
|
||||
Patch release for @fat's n00bery
|
||||
|
||||
- fix missing event type in dropdown
|
||||
- fix delegated data-attrs for popover/tooltip
|
||||
- make carousel actually pause when you click cycle
|
||||
- fix jshint ref in makefile
|
||||
- fix trying to remove backdrop when no backdrop
|
||||
|
||||
## 2.3.0 (February 7, 2013)
|
||||
|
||||
Minor release to add carousel indicators, improve tooltips, improve dev setup, and fix hella bugs.
|
||||
|
||||
- **Repository changes:**
|
||||
- **Local instead of global dependencies** for our makefile and install process. Now getting started is way easier—just run `npm install`.
|
||||
- Upgraded to jQuery 1.9. No changes were needed, but we did upgrade the included jQuery file to the latest release.
|
||||
- Moved changelog to be within the repo instead of as a wiki page.
|
||||
- **New and improved features:**
|
||||
- **Added carousel indicators!** Add the HTML and it automagically works.
|
||||
- **Added `container` option to tooltips.** The default option is still `insertAfter`, but now you may specify where to insert tooltips (and by extension, popovers) with the optional container parameter.
|
||||
- Improved popovers now utilize `max-width` instead of `width`, have been widened from 240px to 280px, and will automatically hide the title if one has not been set via CSS `:empty` selector.
|
||||
- Improved tooltip alignment on edges with [#6713](https://github.com/twitter/bootstrap/pull/6713).
|
||||
- **Improved accessibility for links in all components.** After merging [#6441](https://github.com/twitter/bootstrap/pull/6441), link hover states now apply to the `:focus` state as well. This goes for basic `<a>` tags, as well as buttons, navs, dropdowns, and more.
|
||||
- Added print utility classes to show and hide content between `screen` and `print` via CSS.
|
||||
- Updated input groups to make them behave more like default form controls. Added `display: inline-block;`, increased `margin-bottom`, and added `vertical-align: middle;` to match `<input>` styles.
|
||||
- Added `.horizontal-three-colors()` gradient mixin (with example in the CSS tests file).
|
||||
- Added `.text-left`, `.text-center`, and `.text-right` utility classes for easy typographic alignment.
|
||||
- Added `@ms-viewport` so IE10 can use responsive CSS when in split-screen mode.
|
||||
- **Docs changes:**
|
||||
- Added [new justified navigation example](https://f.cloud.github.com/assets/98681/25869/5e2f812c-4afa-11e2-9293-501cd689232d.png).
|
||||
- Added sticky footer with fixed navbar example.
|
||||
|
||||
See more on the [2.3.0 pull request](https://github.com/twitter/bootstrap/pull/6346).
|
||||
|
||||
|
||||
## 2.2.2 (December 8, 2012)
|
||||
|
||||
Bugfix release addressing docs, CSS, and some JavaScript issues. Key changes include:
|
||||
|
||||
- **Docs:**
|
||||
- Assets (illustrations and examples) are now retina-ready.
|
||||
- Replaced [Placehold.it](http://placehold.it) with [Holder.js](http://imsky.github.com/holder/), a client-side and retina-ready placeholder image tool.
|
||||
- **Dropdowns:** Temporary fix added for dropdowns on mobile to prevent them from closing early.
|
||||
- **Popovers:**
|
||||
- No longer inherits `font-size: 0;` when placed in button groups.
|
||||
- Arrows refactored to work in IE8, and use less code.
|
||||
- Plugin no longer inserts popover content into a `<p>`, but rather directly into `.popover-content`.
|
||||
- **Labels and badges:** Now [automatically collapse](https://github.com/twitter/bootstrap/commit/ead5dbeba5cd7acfa560bfb353f5e7c4f4a19256) if they have no content.
|
||||
- **Tables:** Nesting support with `.table-bordered` and `.table-striped` greatly improved.
|
||||
- **Typeahead:**
|
||||
- Now [inserts dropdown menu after the input](https://github.com/twitter/bootstrap/commit/1747caf19d59cad7fdc90ae56a00e0e2849f95f4) instead of at the close of the document.
|
||||
- Hitting escape will place focus back on the `<input>`.
|
||||
- Print styles, from HTML5 Boilerplate, have been added.
|
||||
|
||||
See more on the [2.2.2 milestone](https://github.com/twitter/bootstrap/issues?milestone=17&state=closed).
|
||||
|
||||
|
||||
## 2.2.1 (October 30, 2012)
|
||||
|
||||
Hotfix release to address the carousel bug reports.
|
||||
|
||||
|
||||
## 2.2.0 (October 29, 2012)
|
||||
|
||||
### tl;dr
|
||||
|
||||
2.1.2 is now 2.2.0: four new example templates, added media component, new typographic scale, fixed that box-shadow mixin bug, fixed z-index issues, and [more](https://github.com/twitter/bootstrap/issues?milestone=15&page=1&state=closed).
|
||||
|
||||
### Highlights
|
||||
|
||||
- **Added four new example templates** to the docs, including a narrow marketing page, sign in form, sticky footer, and a fancy carousel (created for an upcoming .net magazine article).
|
||||
- **Added the media component**, to create larger common components like comments, Tweets, etc.
|
||||
- **New variable-driven typographic scale** based on `@baseFontSize` and `@baseLineHeight`.
|
||||
- Revamped mini, small, and large padding via new variables for inputs and buttons so everything is the same size.
|
||||
- Reverted 2.1.1's `.box-shadow();` mixin change that caused compiler errors.
|
||||
- Improved dropdown submenus to support dropups and left-aligned submenus.
|
||||
- Fixed z-index issues with tooltips and popovers in modals.
|
||||
- Hero unit now sets basic type styles for the entire component, rather than on `.hero-unit p { ... }`.
|
||||
- Updated JavaScript plugins and docs to jQuery 1.8.1.
|
||||
- Added Contributing.md file.
|
||||
- Added support for installing Bootstrap via [Bower](http://twitter.github.com/bower).
|
||||
- Miscellaneous variable improvements across the board.
|
||||
- Miscellaneous documentation typos fixed.
|
||||
|
||||
For the full list of issues included in this release, visit the [2.2.0 milestone on GitHub](https://github.com/twitter/bootstrap/issues?milestone=15&page=1&state=closed)
|
||||
|
||||
|
||||
|
||||
## 2.1.1 (September 4, 2012)
|
||||
|
||||
* New feature: alert text. We documented these new classes, like `.text-success`, at the bottom of the [Typography section](http://twitter.github.com/bootstrap/base-css.html#typography) along with the long undocumented `.muted`.
|
||||
* Fixed a lot of typos in the docs. Spelling is hard.
|
||||
* Made the `.box-shadow()` mixin more durable. It no longer requires escaping for multiple shadows, meaning you can easily use variables and functions in them once again.
|
||||
* Widened `.dl-horizontal dt` and `.horizontal-form .control-group` to better handle the increased font-size.
|
||||
* Dropdown submenus improved: now you only see the next level, not all levels, on hover of the submenu toggle.
|
||||
* Clarified jQuery and Bootstrap template requirements in Getting Started section.
|
||||
* `select` now utilizes `@inputBorder`.
|
||||
* `.lead` now scales up from `@baseFontSize` instead of being a fixed font-size and line-height.
|
||||
* Fixed the vertical three color gradient in latest Firefox.
|
||||
* Reordered some variables that caused errors in certain Less compilers.
|
||||
|
||||
View all closed issues on the [2.1.1 milestone](https://github.com/twitter/bootstrap/issues?milestone=14&state=closed).
|
||||
|
||||
|
||||
## 2.1.0 (August 20, 2012)
|
||||
|
||||
### Key changes
|
||||
|
||||
* Submenu support on dropdowns
|
||||
* Affix JavaScript plugin
|
||||
* Block level buttons
|
||||
* State classes on table rows
|
||||
* Improved disabled states on navs and dropdowns
|
||||
* The navbar component is now white by default, with an optional class to darken it
|
||||
* Improved prepended and appended inputs
|
||||
* New base font-size and line-height
|
||||
* Added variable for navbar collapse trigger point
|
||||
* Fluid grid offsets
|
||||
* Fluid grid system variables are no longer fixed percentages
|
||||
* Removed LESS docs page
|
||||
|
||||
For full set of changes, see the completed milestone: https://github.com/twitter/bootstrap/issues?milestone=7&page=1&state=closed
|
||||
|
||||
## 2.0.4 (June 1, 2012)
|
||||
|
||||
|
||||
### Docs
|
||||
|
||||
- Added `type="button"` to all dismiss buttons in alerts and modals to avoid a bug in which they prevent their parent's `form` from properly submitting.
|
||||
- Added simple documentation to Base CSS for `.lead`.
|
||||
- Added new CSS test to illustrate how the navbar, static and fixed, behaves.
|
||||
- Clarified grid sizing copy to include mention of responsive variations.
|
||||
- Reformatted the LESS docs page to prevent terrible table displays at smaller grid sizes.
|
||||
- Miscellaneous typos and tweaks.
|
||||
|
||||
### CSS
|
||||
|
||||
- Refactored forms.less to make our selectors more specific for fewer overrides and less code. Instead of a generic `input` selector and various resets, we target each type of input like `input[type="text"]`, `input[type="password"]`, etc.
|
||||
- Form field state (e.g., success or error) now applies to checkbox and radio labels.
|
||||
- Removed redundant CSS on `<p>` for `font-family`, `font-size`, and `line-height`.
|
||||
- Removed redundant `color` declaration from the `<label>` element.
|
||||
- Added variables for dropdown dividers border colors.
|
||||
- `legend` and `.form-actions` share the same `border-color`, `#e5e5e5`.
|
||||
- Fixed some responsive issues with input-prepend and -append, notably with the fluid grid.
|
||||
- Added special CSS to prevent `max-width: 100%;` on images from messing up Google Maps rendering.
|
||||
- Scope opened dropdowns to only immediate children to avoid unintended cascade.
|
||||
- Similarly, scope floated-right dropdowns to immediate children with `.pull-right > .dropdown-menu`.
|
||||
- Updated `.placeholder()` mixin to use `&` operator in Less for proper output when compiling.
|
||||
- Added `-ms-input-placeholder` to `.placeholder()` mixin.
|
||||
- Added CSS3 hyphens mixin.
|
||||
- Fixed a bug in IE7/8 where certain form controls would not show text if the parent had a filter opacity set.
|
||||
|
||||
|
||||
## 2.0.3 (April 24, 2012)
|
||||
|
||||
Running makefile now require JSHint and Recess.
|
||||
|
||||
### HTML and CSS
|
||||
|
||||
- Overhauled the responsive utility classes to simplify required CSS, add `!important` to all declarations, and use `display: inherit` in place of `display: block` to account for different types of elements.
|
||||
- Removed `>` from fluid grid column selectors, meaning every element with a `.span*` class within a `.row-fluid` will use percentage widths instead of fixed-pixels.
|
||||
- Fixed regression in responsive images support as of 2.0.1. We've re-added `max-width: 100%;` to images by default. We removed it in our last release since we had folks complaining about Google Maps integration and other projects, but we're taking a different stance now on these things and will require developers to make these tweaks on their end.
|
||||
- Added variable `@navbarBrandColor` for the brand element in navbars, which defaults to `@navbarLinkColor`.
|
||||
- Font-family mixins now use variables for their stacks.
|
||||
- Fixed an unescaped `filter` on the `.reset-filter()` mixin that was causing some errors depending on your compiler.
|
||||
- Fixed regression in `.form-actions` background, which was too dark, by adding a new variable `@formActionsBackground` and changing the color to `#f5f5f5` instead of `#eee`.
|
||||
- Fixed an issue on button group dropdowns where the background color was not using the button's darker color when the dropdown is open.
|
||||
- Generalized and simplified the open dropdown classes while adding smarter defaults. Instead of `.dropdown.open`, we now use just `.open`. On the defaults side, all dropdown menus now have rounded corners to start.
|
||||
- Improved active `.dropdown-toggle` styles (for dropdown buttons) by darkening the background and sharpening the inset shadow to match the active state of buttons.
|
||||
- Direction of animation on progress bars reversed.
|
||||
- Fixed input-prepend/append issue with uneditable inputs: `.uneditable-input` was being floated and a missing comma meant its `border-radius` for the append option wasn't being applied properly.
|
||||
- Removed `height: auto;` from `img` since it was overriding dimensions set via HTML attributes.
|
||||
- Fixed an issue of double borders on the top of tables with captions or colgroups.
|
||||
- Fixed issue with anchor buttons in the `.navbar-text`. Instead of a general styling on all anchors within an element with that class, we now have a new class to specifically apply appropriate link color.
|
||||
- Added support for `@navbarHeight` on the brand/project name and nav links for complete navbar height customization.
|
||||
- Fixed the black borders on buttons problem in IE7 by removing the border, increasing the line-height, and providing darker background colors.
|
||||
- Removed excess padding on `.search-query` inputs in IE7 since it doesn't have border-radius.
|
||||
- Updated alert messages in Components to use `button` elements as close icons instead of `a`. Both can be used, but an `a` will require `href="#"` for dismissal on iOS devices.
|
||||
- Fixed an issue with prepended/appended inputs in Firefox where `select` elements required two clicks to toggle the dropdown. Resolved by moving the `position: relative` to the `select` by default instead of on `:focus`.
|
||||
- Added a new mixin, `.backface-visibility`, to help refine CSS 3D tranforms. Examples and explanation of usage can be found on [CSS Tricks](http://css-tricks.com/almanac/properties/b/backface-visibility/).
|
||||
- Changed specificity of grid classes in responsive layouts under 767px to accurately target `input`, `select`, and `textarea` elements that use `.span*` classes.
|
||||
- Horizontal description lists, `.dl-horizontal`, now truncate terms that are too long to fit in their fixed-width column. In the < 767px responsive layout, they change to their default stacked layout.
|
||||
- Changed tabbable tabs to prevent issues in left and right aligned tabs. `.tab-content` would not growing to its parent's full width due to `display: table`. We removed that and the `width: 100%` and instead just set `overflow: auto` to clear the left and right aligned tabs.
|
||||
- Updated thumbnails to support fluid grid column sizing.
|
||||
- Added `>` to most of the button group selectors
|
||||
- Added new variable, `@inputBorderRadius`, to all form controls that previously made use of the static `3px` value everywhere.
|
||||
- Changed the way we do `border-radius` for tables. Instead of the regular mixin that zeros out all other corners, we specify one corner only so they can be combined for use on single column table headers.
|
||||
- Updated Glyphicons Halflings from 1.5 to 1.6, introducing 20 new icons.
|
||||
- Added an `offset` paramater to the `.makeColumn`.
|
||||
- Increased the specificity of all tabbable nav selectors to include `.nav-collapse` to appropriately scope the responsive navbar behavior.
|
||||
- Fixed uneditable inputs: text now cuts off and does not wrap, making it behave just like a default `input`.
|
||||
- Labels and badges are now `vertical-align: baseline;` so they line up with surrounding text.
|
||||
|
||||
### Javascript
|
||||
|
||||
- Add jshint support
|
||||
- Add travis-ci support w/ headless phantom integration
|
||||
- Replace UA sniffing in bootstrap-transitions.js
|
||||
- Add MSTransitionEnd event to transition plugin
|
||||
- Fix pause method in carousel (shouldn't restart when hovering over controls)
|
||||
- Fix crazy opera bug #1776
|
||||
- Don't open dropdown if target element is disabled
|
||||
- Always select last item in scrollspy if you've reached the bottom of the document or element
|
||||
- Typeahead should escape regexp special chars
|
||||
- If interval is false on carousel, do not auto-cycle
|
||||
- Add preventDefault support for all initial event types (show, close, hide, etc.)
|
||||
- Fix collapse bug in ie7+ for initial collapse in
|
||||
- Fix nested collapse bug
|
||||
- If transitioning collapse, don't start new transition
|
||||
- Try to autodetect when to use html/text method in tooltip/popovers to help prevent xss
|
||||
- Add bootstrap + bootstrap.min.js to gh-pages for @remy and jsbin support
|
||||
|
||||
### Documentation and repo
|
||||
|
||||
- Combined badges and labels into a single LESS file, labels-badges.less, to reduce repeated CSS.
|
||||
- Separated responsive features into multiple files. We now have a file for each grouping of media queries (tablets and down, tablets to desktops, and large desktops). Additionally, the visible/hidden utility classes and the responsive navbar are in their own files. The output is the same in the compiled CSS, but this should give folks a bit more flexibility.
|
||||
- Added a new CSS Tests page in the docs (not in the top nav) for better testing of edge cases and extending the use of standard components.
|
||||
- Removed the bootstrap.zip file from the repo and the make process for faster building and a lighter repo. From now on, the zip will only be in the documentation branch.
|
||||
- Fixed incorrect use of class instead of ID for tabs example and added documentation for multiple ways of toggling tabs.
|
||||
- Fixed required markup listed for the specialized navbar search field.
|
||||
- Removed all mention of `@siteWidth`, a variable no longer in use.
|
||||
- Removed mentions of unused `@buttonPrimaryBackground` variable, which is no longer in use.
|
||||
- Updated LESS docs page to include all the new variables we added in previous releases.
|
||||
- Removed broken "dropup" menus from tabs and pills examples (shouldn't have been there in the first place).
|
||||
- Replaced `.badge-error` with `.badge-important`. The error option is not a valid class and was a typo in the docs.
|
||||
- Fixed mention of how to add plain text to the navbar. Previously the docs stated you only needed a `p` tag, but the required HTML is any element with class `.navbar-text`.
|
||||
- Clarified the use of `.tabbable` for tabs. The wrapping class is only required for left and right tabs to clear their floats. Also added mention of `.fade` to fade in tabs.
|
||||
- Updated forms documentation:
|
||||
- Remove unnecessary duplicate help text in first example
|
||||
- Added mention of required `input` class, `.search-query`, for the search form variation
|
||||
- Removed incorrect mention of form fields being `display: block;` to start as fields are `inline-block` to start.
|
||||
- Added mention of `data-target` attribute for the dropdowns javascript plugin to show how to keep custom URLs intact on links with `.dropdown-toggle` class.
|
||||
- Updated the Kippt screenshot on the homepage to reflect their recent responsive redesign and upgrade to 2.0.2.
|
||||
|
||||
|
||||
## 2.0.2 (March 12, 2012)
|
||||
|
||||
Overview of docs changes, bugfixes, and new features.
|
||||
|
||||
### Documentation updates
|
||||
|
||||
- All docs pages now have distinct titles, such as <em>Scaffolding · Twitter Bootstrap</em>.
|
||||
- Updated the Apple touch icons (now black on black instead of the blue grid) and fixed the links to them in the docs.
|
||||
- Added new global styles docs section to the Scaffolding page.
|
||||
- Required use of HTML5 doctype
|
||||
- Overview of global typographic and links details
|
||||
- Mention of our embedded CSS reset via [Normalize.css](http://necolas.github.com/normalize.css/)
|
||||
- Added version number to the download button on the docs homepage.
|
||||
- Updated progress bars section to simplify how the classes stack and more clearly indicate the available optional classes and styles.
|
||||
- Added a new example, [SoundReady.fm](http://soundready.fm), to the homepage
|
||||
- Added various sizes to the docs for button groups
|
||||
|
||||
### Resolved bugs
|
||||
|
||||
- Removed all IE7 hacks and floats from `.input-prepend` and `.input-append`, however, this requires you to **ensure there is no whitespace in your code** between `.add-on` and the `input`.
|
||||
- In `.input-prepend` and `.input-append`, added ability to use add-ons on both sides when you chain the selectors.
|
||||
- Updated lingering `.btn-dark` reference to `.btn-inverse`.
|
||||
- Fixed issue with content being cut off in `.tab-content` for tabbable sections.
|
||||
- Updated `.navbar .container` to use `width: auto;` to start and then reset the fixed widths via the `#gridSystem` mixin (it's a little dirty, but required to avoid adding another class).
|
||||
- Modal footer buttons are now aligned by their parent via `text-align: right;` instead of `float: right` on the button level. This was changed to allow the use of `.pull-left` and `.pull-right` to align buttons easily. Double check your button order with this change!
|
||||
- Fixed problem where default striped progress bar was green instead of blue.
|
||||
- Fixed CSS selector used for `input` and `textarea` grid sizes to properly apply the CSS (was `input > .span*` and now is `input.span*`).
|
||||
|
||||
### New features
|
||||
|
||||
- Horizontal dividers support added to nav lists
|
||||
- Added basic version of badges
|
||||
- Added visible/hidden classes for devices
|
||||
- Added support for buttons in input-prepend/append component
|
||||
- Added .navbar-fixed-bottom support
|
||||
- Added .dropup support for dropdown menus to pop them upward instead of downward (this is automatically done for the newly added fixed bottom navbar).
|
||||
- Added mixin for [new image replacement technique](http://www.zeldman.com/2012/03/01/replacing-the-9999px-hack-new-image-replacement/)
|
||||
- Added pause on hover for the carousel
|
||||
- Added tons of new variables for typography, buttons, forms, dropdowns, navbar, and more for the LESS pros out there. These variables have also been reflected on the Customize page.
|
||||
- Added new horizontal description list variation
|
||||
- Added `.disabled` class support to the pager component (also added a mention of this to the docs)
|
||||
- Added `.well-large` and `.well-small` classes for extending the well component
|
||||
|
||||
For a full issue-by-issue rundown of the release, check out the now closed [2.0.2 milestone on GitHub](https://github.com/twitter/bootstrap/issues?sort=created&direction=desc&state=closed&page=1&milestone=9)
|
||||
|
||||
## v2.0.1 (February 17, 2012)
|
||||
|
||||
Overview of changes:
|
||||
|
||||
- Previously the docs called for use of `.control-label` in the examples, but the CSS didn't make clear use of it. This class is required for horizontal forms and has been reflected in the CSS.
|
||||
- We've tried our best to improve rendering of buttons and icons across all browsers. Some issues remain; Firefox throws an `!important`on `line-height` for inputs, so that's the big one.
|
||||
- We refined the label component style to move away from uppercase.
|
||||
- Added the black button option, `.btn-inverse`.
|
||||
- Added a mini button class, `.btn-mini`.
|
||||
- We had to re-add the protocol, `http:` to the HTML5 schim because IE7-8 wouldn't recognize it, dropping some HTML5 support for those browsers and introducing major performance issues.
|
||||
- Resolved some issues with responsive layouts where media queries would overlap at 768px and 980px.
|
||||
- Rearranged Scaffolding docs page to split fixed and fluid grid systems.
|
||||
- Tons of docs updates for typos and language changes.
|
||||
|
||||
For full list of changes, see the now closed [v2.0.1 milestone](https://github.com/twitter/bootstrap/issues?milestone=8&state=closed).
|
||||
|
||||
## v2.0.0 (January 28, 2012)
|
||||
Complete rewrite of the library. For full details, head to the upgrading doc at http://twitter.github.com/bootstrap/upgrading.html.
|
||||
|
||||
## v1.4.0
|
||||
### Key bug fixes and changes
|
||||
- **Updated tables** to make no border the default and add options for condensed and bordered versions
|
||||
- **Updated form states** to expand on error styles and provide warning and success variations
|
||||
- New javascript plugin for button states
|
||||
- Switched to strict mode for Javascript plugins
|
||||
- Added more data attribute controls to our plugins
|
||||
- Full list of 25+ issues fixed: https://github.com/twitter/bootstrap/issues?milestone=6&state=closed
|
||||
|
||||
## v1.3.0
|
||||
### New features
|
||||
- **Javascript plugins** for modals, alerts, dropdowns, scrollspy, tabs, tooltips, and popovers that work with jQuery and Ender
|
||||
- **Massively updated docs** for both the main page and for the new javascript plugins
|
||||
- **Inline labels** for marking inline content with key visual flags
|
||||
- Media thumbnails
|
||||
- Breadcrumbs
|
||||
|
||||
### Updated docs
|
||||
- Added complete javascript page with detailed documentation for how to use plugins
|
||||
- Three complete example pages of using Bootstrap, linked from main docs page with thumbnails
|
||||
- Added section for compiling Less, for guidelines on how to recompile Bootstrap with Less
|
||||
- Added section for customizing grid variables in Less to roll your own grid system
|
||||
- Added section for code for using pre and code tags
|
||||
- Added section for form field sizes that match grid column sizes
|
||||
|
||||
### Key bug fixes and changes
|
||||
- Updated table styles to be just a tad bit more refined
|
||||
- Added new form input sizes based on the Bootstrap grid system (meaning now you can do `input.span5` for a 280px-wide input)
|
||||
- Removed `:focus` states from `:active` links in Firefox
|
||||
- Fixed unqualified `.clearfix` in forms.less that added bottom margin to all containers
|
||||
- Updated `.container()` mixing to be `.fixed-container()` to prevent conflicts when compiling
|
||||
- Added focus states (either `box-shadow` or `outline` on `:focus`) to all buttons, links, and inputs
|
||||
- No longer require `h3` in topbar, but still support for backwards compatibility
|
||||
|
||||
## v1.2.0
|
||||
- **Dropdowns refactored** to be extensible (now work in ul.tabs)
|
||||
- **Added HTML5 form support** by generalizing the form selectors (e.g., input instead of input[type=text|password])
|
||||
- **Gradients back in IE**, but removed rounded corners in IE9 to prevent background bleed on buttons and alert messages
|
||||
- **Simplified the grid CSS** by removing the static .span1-16 classes in favor of CSS-style regex for column styles in the grid
|
||||
- **Added .one-third and .two-thirds columns** to the grid system
|
||||
- Fixed bug in disabled buttons where they received :active styles
|
||||
- Bug fixes
|
||||
|
||||
## v1.1.1
|
||||
- **Redesigned alerts** to be more readable
|
||||
- **Refactored buttons and alerts CSS** to be simpler
|
||||
- Updated grid system to be more specific and not require .column or columns
|
||||
- Improved on specificity of CSS selectors by removing unnecessary tag and parent selectors
|
||||
- Miscellaneous updates to docs
|
||||
- Bug fixes
|
||||
|
||||
## v1.1.0
|
||||
- **Added support for IE7 and IE8**
|
||||
- Added examples directory with first example usage of Bootstrap for a simple website
|
||||
- Syntax fixes for gradients and color-stops
|
||||
- Miscellaneous updates to docs
|
||||
- Bug fixes
|
||||
|
||||
## v1.0.0
|
||||
- **Initial release**
|
||||
75
src/vendor/bootstrap-2.3.1/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
# Contributing to Bootstrap
|
||||
|
||||
Looking to contribute something to Bootstrap? **Here's how you can help.**
|
||||
|
||||
|
||||
|
||||
## Reporting issues
|
||||
|
||||
We only accept issues that are bug reports or feature requests. Bugs must be isolated and reproducible problems that we can fix within the Bootstrap core. Please read the following guidelines before opening any issue.
|
||||
|
||||
1. **Search for existing issues.** We get a lot of duplicate issues, and you'd help us out a lot by first checking if someone else has reported the same issue. Moreover, the issue may have already been resolved with a fix available.
|
||||
2. **Create an isolated and reproducible test case.** Be sure the problem exists in Bootstrap's code with a [reduced test cases](http://css-tricks.com/reduced-test-cases/) that should be included in each bug report.
|
||||
3. **Include a live example.** Make use of jsFiddle or jsBin to share your isolated test cases.
|
||||
4. **Share as much information as possible.** Include operating system and version, browser and version, version of Bootstrap, customized or vanilla build, etc. where appropriate. Also include steps to reproduce the bug.
|
||||
|
||||
|
||||
|
||||
## Key branches
|
||||
|
||||
- `master` is the latest, deployed version.
|
||||
- `gh-pages` is the hosted docs (not to be used for pull requests).
|
||||
- `*-wip` is the official work in progress branch for the next release.
|
||||
|
||||
|
||||
|
||||
## Notes on the repo
|
||||
|
||||
As of v2.0.0, Bootstrap's documentation is powered by Mustache templates and built via `make` before each commit and release. This was done to enable internationalization (translation) in a future release by uploading our strings to the [Twitter Translation Center](http://translate.twttr.com/). Any edits to the docs should be first done in the Mustache files and then recompiled into the HTML.
|
||||
|
||||
|
||||
|
||||
## Pull requests
|
||||
|
||||
- Try to submit pull requests against the latest `*-wip` branch for easier merging
|
||||
- Any changes to the docs must be made to the Mustache templates, not just the compiled HTML pages
|
||||
- CSS changes must be done in .less files first, never just the compiled files
|
||||
- If modifying the .less files, always recompile and commit the compiled files bootstrap.css and bootstrap.min.css
|
||||
- Try not to pollute your pull request with unintended changes--keep them simple and small
|
||||
- Try to share which browsers your code has been tested in before submitting a pull request
|
||||
|
||||
|
||||
|
||||
## Coding standards: HTML
|
||||
|
||||
- Two spaces for indentation, never tabs
|
||||
- Double quotes only, never single quotes
|
||||
- Always use proper indentation
|
||||
- Use tags and elements appropriate for an HTML5 doctype (e.g., self-closing tags)
|
||||
|
||||
|
||||
|
||||
## Coding standards: CSS
|
||||
|
||||
- Adhere to the [Recess CSS property order](http://markdotto.com/2011/11/29/css-property-order/)
|
||||
- Multiple-line approach (one property and value per line)
|
||||
- Always a space after a property's colon (.e.g, `display: block;` and not `display:block;`)
|
||||
- End all lines with a semi-colon
|
||||
- For multiple, comma-separated selectors, place each selector on it's own line
|
||||
- Attribute selectors, like `input[type="text"]` should always wrap the attribute's value in double quotes, for consistency and safety (see this [blog post on unquoted attribute values](http://mathiasbynens.be/notes/unquoted-attribute-values) that can lead to XSS attacks).
|
||||
|
||||
|
||||
|
||||
## Coding standards: JS
|
||||
|
||||
- No semicolons
|
||||
- Comma first
|
||||
- 2 spaces (no tabs)
|
||||
- strict mode
|
||||
- "Attractive"
|
||||
|
||||
|
||||
|
||||
## License
|
||||
|
||||
By contributing your code, you agree to license your contribution under the terms of the APLv2: https://github.com/twitter/bootstrap/blob/master/LICENSE
|
||||
176
src/vendor/bootstrap-2.3.1/LICENSE
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
126
src/vendor/bootstrap-2.3.1/Makefile
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
BOOTSTRAP = ./docs/assets/css/bootstrap.css
|
||||
BOOTSTRAP_LESS = ./less/bootstrap.less
|
||||
BOOTSTRAP_RESPONSIVE = ./docs/assets/css/bootstrap-responsive.css
|
||||
BOOTSTRAP_RESPONSIVE_LESS = ./less/responsive.less
|
||||
DATE=$(shell date +%I:%M%p)
|
||||
CHECK=\033[32m✔\033[39m
|
||||
HR=\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
|
||||
|
||||
|
||||
#
|
||||
# BUILD DOCS
|
||||
#
|
||||
|
||||
build:
|
||||
@echo "\n${HR}"
|
||||
@echo "Building Bootstrap..."
|
||||
@echo "${HR}\n"
|
||||
@./node_modules/.bin/jshint js/*.js --config js/.jshintrc
|
||||
@./node_modules/.bin/jshint js/tests/unit/*.js --config js/.jshintrc
|
||||
@echo "Running JSHint on javascript... ${CHECK} Done"
|
||||
@./node_modules/.bin/recess --compile ${BOOTSTRAP_LESS} > ${BOOTSTRAP}
|
||||
@./node_modules/.bin/recess --compile ${BOOTSTRAP_RESPONSIVE_LESS} > ${BOOTSTRAP_RESPONSIVE}
|
||||
@echo "Compiling LESS with Recess... ${CHECK} Done"
|
||||
@node docs/build
|
||||
@cp img/* docs/assets/img/
|
||||
@cp js/*.js docs/assets/js/
|
||||
@cp js/tests/vendor/jquery.js docs/assets/js/
|
||||
@echo "Compiling documentation... ${CHECK} Done"
|
||||
@cat js/bootstrap-transition.js js/bootstrap-alert.js js/bootstrap-button.js js/bootstrap-carousel.js js/bootstrap-collapse.js js/bootstrap-dropdown.js js/bootstrap-modal.js js/bootstrap-tooltip.js js/bootstrap-popover.js js/bootstrap-scrollspy.js js/bootstrap-tab.js js/bootstrap-typeahead.js js/bootstrap-affix.js > docs/assets/js/bootstrap.js
|
||||
@./node_modules/.bin/uglifyjs -nc docs/assets/js/bootstrap.js > docs/assets/js/bootstrap.min.tmp.js
|
||||
@echo "/**\n* Bootstrap.js v2.3.1 by @fat & @mdo\n* Copyright 2012 Twitter, Inc.\n* http://www.apache.org/licenses/LICENSE-2.0.txt\n*/" > docs/assets/js/copyright.js
|
||||
@cat docs/assets/js/copyright.js docs/assets/js/bootstrap.min.tmp.js > docs/assets/js/bootstrap.min.js
|
||||
@rm docs/assets/js/copyright.js docs/assets/js/bootstrap.min.tmp.js
|
||||
@echo "Compiling and minifying javascript... ${CHECK} Done"
|
||||
@echo "\n${HR}"
|
||||
@echo "Bootstrap successfully built at ${DATE}."
|
||||
@echo "${HR}\n"
|
||||
@echo "Thanks for using Bootstrap,"
|
||||
@echo "<3 @mdo and @fat\n"
|
||||
|
||||
#
|
||||
# RUN JSHINT & QUNIT TESTS IN PHANTOMJS
|
||||
#
|
||||
|
||||
test:
|
||||
./node_modules/.bin/jshint js/*.js --config js/.jshintrc
|
||||
./node_modules/.bin/jshint js/tests/unit/*.js --config js/.jshintrc
|
||||
node js/tests/server.js &
|
||||
phantomjs js/tests/phantom.js "http://localhost:3000/js/tests"
|
||||
kill -9 `cat js/tests/pid.txt`
|
||||
rm js/tests/pid.txt
|
||||
|
||||
#
|
||||
# CLEANS THE ROOT DIRECTORY OF PRIOR BUILDS
|
||||
#
|
||||
|
||||
clean:
|
||||
rm -r bootstrap
|
||||
|
||||
#
|
||||
# BUILD SIMPLE BOOTSTRAP DIRECTORY
|
||||
# recess & uglifyjs are required
|
||||
#
|
||||
|
||||
bootstrap: bootstrap-img bootstrap-css bootstrap-js
|
||||
|
||||
|
||||
#
|
||||
# JS COMPILE
|
||||
#
|
||||
bootstrap-js: bootstrap/js/*.js
|
||||
|
||||
bootstrap/js/*.js: js/*.js
|
||||
mkdir -p bootstrap/js
|
||||
cat js/bootstrap-transition.js js/bootstrap-alert.js js/bootstrap-button.js js/bootstrap-carousel.js js/bootstrap-collapse.js js/bootstrap-dropdown.js js/bootstrap-modal.js js/bootstrap-tooltip.js js/bootstrap-popover.js js/bootstrap-scrollspy.js js/bootstrap-tab.js js/bootstrap-typeahead.js js/bootstrap-affix.js > bootstrap/js/bootstrap.js
|
||||
./node_modules/.bin/uglifyjs -nc bootstrap/js/bootstrap.js > bootstrap/js/bootstrap.min.tmp.js
|
||||
echo "/*!\n* Bootstrap.js by @fat & @mdo\n* Copyright 2012 Twitter, Inc.\n* http://www.apache.org/licenses/LICENSE-2.0.txt\n*/" > bootstrap/js/copyright.js
|
||||
cat bootstrap/js/copyright.js bootstrap/js/bootstrap.min.tmp.js > bootstrap/js/bootstrap.min.js
|
||||
rm bootstrap/js/copyright.js bootstrap/js/bootstrap.min.tmp.js
|
||||
|
||||
#
|
||||
# CSS COMPLILE
|
||||
#
|
||||
|
||||
bootstrap-css: bootstrap/css/*.css
|
||||
|
||||
bootstrap/css/*.css: less/*.less
|
||||
mkdir -p bootstrap/css
|
||||
./node_modules/.bin/recess --compile ${BOOTSTRAP_LESS} > bootstrap/css/bootstrap.css
|
||||
./node_modules/.bin/recess --compress ${BOOTSTRAP_LESS} > bootstrap/css/bootstrap.min.css
|
||||
./node_modules/.bin/recess --compile ${BOOTSTRAP_RESPONSIVE_LESS} > bootstrap/css/bootstrap-responsive.css
|
||||
./node_modules/.bin/recess --compress ${BOOTSTRAP_RESPONSIVE_LESS} > bootstrap/css/bootstrap-responsive.min.css
|
||||
|
||||
#
|
||||
# IMAGES
|
||||
#
|
||||
|
||||
bootstrap-img: bootstrap/img/*
|
||||
|
||||
bootstrap/img/*: img/*
|
||||
mkdir -p bootstrap/img
|
||||
cp img/* bootstrap/img/
|
||||
|
||||
|
||||
#
|
||||
# MAKE FOR GH-PAGES 4 FAT & MDO ONLY (O_O )
|
||||
#
|
||||
|
||||
gh-pages: bootstrap docs
|
||||
rm -f docs/assets/bootstrap.zip
|
||||
zip -r docs/assets/bootstrap.zip bootstrap
|
||||
rm -r bootstrap
|
||||
rm -f ../bootstrap-gh-pages/assets/bootstrap.zip
|
||||
node docs/build production
|
||||
cp -r docs/* ../bootstrap-gh-pages
|
||||
|
||||
#
|
||||
# WATCH LESS FILES
|
||||
#
|
||||
|
||||
watch:
|
||||
echo "Watching less files..."; \
|
||||
watchr -e "watch('less/.*\.less') { system 'make' }"
|
||||
|
||||
|
||||
.PHONY: docs watch gh-pages bootstrap-img bootstrap-css bootstrap-js
|
||||
117
src/vendor/bootstrap-2.3.1/README.md
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
<a href="http://getbootstrap.com">
|
||||
<img src="http://twitter.github.com/bootstrap/assets/img/bootstrap-docs-readme.png" width="100px">
|
||||
</a>
|
||||
|
||||
# [Bootstrap v2.3.1](http://twitter.github.com/bootstrap) [](http://travis-ci.org/twitter/bootstrap)
|
||||
|
||||
Bootstrap is a sleek, intuitive, and powerful front-end framework for faster and easier web development, created and maintained by [Mark Otto](http://twitter.com/mdo) and [Jacob Thornton](http://twitter.com/fat).
|
||||
|
||||
To get started, checkout [http://getbootstrap.com](http://getbootstrap.com)!
|
||||
|
||||
|
||||
|
||||
## Quick start
|
||||
|
||||
Three quick start options are available:
|
||||
|
||||
* [Download the latest release](https://github.com/twitter/bootstrap/zipball/master).
|
||||
* Clone the repo: `git clone git://github.com/twitter/bootstrap.git`.
|
||||
* Install with Twitter's [Bower](http://twitter.github.com/bower): `bower install bootstrap`.
|
||||
|
||||
|
||||
|
||||
## Versioning
|
||||
|
||||
For transparency and insight into our release cycle, and for striving to maintain backward compatibility, Bootstrap will be maintained under the Semantic Versioning guidelines as much as possible.
|
||||
|
||||
Releases will be numbered with the following format:
|
||||
|
||||
`<major>.<minor>.<patch>`
|
||||
|
||||
And constructed with the following guidelines:
|
||||
|
||||
* Breaking backward compatibility bumps the major (and resets the minor and patch)
|
||||
* New additions without breaking backward compatibility bumps the minor (and resets the patch)
|
||||
* Bug fixes and misc changes bumps the patch
|
||||
|
||||
For more information on SemVer, please visit [http://semver.org/](http://semver.org/).
|
||||
|
||||
|
||||
|
||||
## Bug tracker
|
||||
|
||||
Have a bug or a feature request? [Please open a new issue](https://github.com/twitter/bootstrap/issues). Before opening any issue, please search for existing issues and read the [Issue Guidelines](https://github.com/necolas/issue-guidelines), written by [Nicolas Gallagher](https://github.com/necolas/).
|
||||
|
||||
|
||||
|
||||
## Community
|
||||
|
||||
Keep track of development and community news.
|
||||
|
||||
* Follow [@twbootstrap on Twitter](http://twitter.com/twbootstrap).
|
||||
* Read and subscribe to the [The Official Twitter Bootstrap Blog](http://blog.getbootstrap.com).
|
||||
* Have a question that's not a feature request or bug report? [Ask on the mailing list.](http://groups.google.com/group/twitter-bootstrap)
|
||||
* Chat with fellow Bootstrappers in IRC. On the `irc.freenode.net` server, in the `##twitter-bootstrap` channel.
|
||||
|
||||
|
||||
|
||||
## Compiling CSS and JavaScript
|
||||
|
||||
Bootstrap includes a [makefile](Makefile) with convenient methods for working with the framework. Before getting started, be sure to install [the necessary local dependencies](package.json):
|
||||
|
||||
```
|
||||
$ npm install
|
||||
```
|
||||
|
||||
When completed, you'll be able to run the various make commands provided:
|
||||
|
||||
#### build - `make`
|
||||
Runs the recess compiler to rebuild the `/less` files and compiles the docs. Requires recess and uglify-js.
|
||||
|
||||
#### test - `make test`
|
||||
Runs jshint and qunit tests headlessly in [phantomjs](http://code.google.com/p/phantomjs/) (used for ci). Depends on having phantomjs installed.
|
||||
|
||||
#### watch - `make watch`
|
||||
This is a convenience method for watching just Less files and automatically building them whenever you save. Requires the Watchr gem.
|
||||
|
||||
Should you encounter problems with installing dependencies or running the makefile commands, be sure to first uninstall any previous versions (global and local) you may have installed, and then rerun `npm install`.
|
||||
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
Please submit all pull requests against *-wip branches. If your pull request contains JavaScript patches or features, you must include relevant unit tests. All HTML and CSS should conform to the [Code Guide](http://github.com/mdo/code-guide), maintained by [Mark Otto](http://github.com/mdo).
|
||||
|
||||
Thanks!
|
||||
|
||||
|
||||
|
||||
## Authors
|
||||
|
||||
**Mark Otto**
|
||||
|
||||
+ [http://twitter.com/mdo](http://twitter.com/mdo)
|
||||
+ [http://github.com/mdo](http://github.com/mdo)
|
||||
|
||||
**Jacob Thornton**
|
||||
|
||||
+ [http://twitter.com/fat](http://twitter.com/fat)
|
||||
+ [http://github.com/fat](http://github.com/fat)
|
||||
|
||||
|
||||
|
||||
## Copyright and license
|
||||
|
||||
Copyright 2012 Twitter, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this work except in compliance with the License.
|
||||
You may obtain a copy of the License in the LICENSE file, or at:
|
||||
|
||||
[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
8
src/vendor/bootstrap-2.3.1/component.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "bootstrap",
|
||||
"version": "2.3.1",
|
||||
"main": ["./docs/assets/js/bootstrap.js", "./docs/assets/css/bootstrap.css"],
|
||||
"dependencies": {
|
||||
"jquery": "~1.8.0"
|
||||
}
|
||||
}
|
||||
9
src/vendor/bootstrap-2.3.1/composer.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "twitter/bootstrap"
|
||||
, "description": "Sleek, intuitive, and powerful front-end framework for faster and easier web development."
|
||||
, "keywords": ["bootstrap", "css"]
|
||||
, "homepage": "http://twitter.github.com/bootstrap/"
|
||||
, "author": "Twitter Inc."
|
||||
, "license": "Apache-2.0"
|
||||
|
||||
}
|
||||
1109
src/vendor/bootstrap-2.3.1/docs/assets/css/bootstrap-responsive.css
vendored
Normal file
6158
src/vendor/bootstrap-2.3.1/docs/assets/css/bootstrap.css
vendored
Normal file
1067
src/vendor/bootstrap-2.3.1/docs/assets/css/docs.css
vendored
Normal file
BIN
src/vendor/bootstrap-2.3.1/docs/assets/ico/apple-touch-icon-114-precomposed.png
vendored
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src/vendor/bootstrap-2.3.1/docs/assets/ico/apple-touch-icon-144-precomposed.png
vendored
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
src/vendor/bootstrap-2.3.1/docs/assets/ico/apple-touch-icon-57-precomposed.png
vendored
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
src/vendor/bootstrap-2.3.1/docs/assets/ico/apple-touch-icon-72-precomposed.png
vendored
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
src/vendor/bootstrap-2.3.1/docs/assets/ico/favicon.ico
vendored
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
src/vendor/bootstrap-2.3.1/docs/assets/ico/favicon.png
vendored
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
src/vendor/bootstrap-2.3.1/docs/assets/img/bootstrap-docs-readme.png
vendored
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
src/vendor/bootstrap-2.3.1/docs/assets/img/bootstrap-mdo-sfmoma-01.jpg
vendored
Normal file
|
After Width: | Height: | Size: 122 KiB |
BIN
src/vendor/bootstrap-2.3.1/docs/assets/img/bootstrap-mdo-sfmoma-02.jpg
vendored
Normal file
|
After Width: | Height: | Size: 79 KiB |
BIN
src/vendor/bootstrap-2.3.1/docs/assets/img/bootstrap-mdo-sfmoma-03.jpg
vendored
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
src/vendor/bootstrap-2.3.1/docs/assets/img/bs-docs-bootstrap-features.png
vendored
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src/vendor/bootstrap-2.3.1/docs/assets/img/bs-docs-masthead-pattern.png
vendored
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
src/vendor/bootstrap-2.3.1/docs/assets/img/bs-docs-responsive-illustrations.png
vendored
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
src/vendor/bootstrap-2.3.1/docs/assets/img/bs-docs-twitter-github.png
vendored
Normal file
|
After Width: | Height: | Size: 30 KiB |