diff --git a/Gemfile b/Gemfile index e72101e..8abe61d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,28 +1,16 @@ source 'https://rubygems.org' -ruby '1.9.3' -gem 'rails', '3.2.13' +ruby '2.2.2' +gem 'rails', '4.2.3' gem 'pg' # Gems used only for assets and not required # in production environments by default. group :assets do - gem 'sass-rails', '~> 3.2.3' - gem 'coffee-rails', '~> 3.2.1' - gem 'uglifier', '>= 1.0.3' + gem 'sass-rails' + gem 'coffee-rails', '~> 4.1.0' + gem 'uglifier', '~> 2.7.1' end gem 'jquery-rails' - -# To use ActiveModel has_secure_password -# gem 'bcrypt-ruby', '~> 3.0.0' - -# To use Jbuilder templates for JSON -# gem 'jbuilder' - -# Deploy with Capistrano -# gem 'capistrano' - -# To use debugger -# gem 'debugger' diff --git a/Gemfile.lock b/Gemfile.lock index 6b06a9f..9f056d6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,111 +1,130 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (3.2.13) - actionpack (= 3.2.13) - mail (~> 2.5.3) - actionpack (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) + actionmailer (4.2.3) + actionpack (= 4.2.3) + actionview (= 4.2.3) + activejob (= 4.2.3) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.3) + actionview (= 4.2.3) + activesupport (= 4.2.3) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.3) + activesupport (= 4.2.3) + builder (~> 3.1) erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - activerecord (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - activesupport (3.2.13) - i18n (= 0.6.1) - multi_json (~> 1.0) - arel (3.0.2) - builder (3.0.4) - coffee-rails (3.2.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (4.2.3) + activesupport (= 4.2.3) + globalid (>= 0.3.0) + activemodel (4.2.3) + activesupport (= 4.2.3) + builder (~> 3.1) + activerecord (4.2.3) + activemodel (= 4.2.3) + activesupport (= 4.2.3) + arel (~> 6.0) + activesupport (4.2.3) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + arel (6.0.3) + builder (3.2.2) + coffee-rails (4.1.0) coffee-script (>= 2.2.0) - railties (~> 3.2.0) - coffee-script (2.2.0) + railties (>= 4.0.0, < 5.0) + coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.6.2) + coffee-script-source (1.9.1.1) erubis (2.7.0) - execjs (1.4.0) - multi_json (~> 1.0) - hike (1.2.3) - i18n (0.6.1) - journey (1.0.4) - jquery-rails (3.0.1) - railties (>= 3.0, < 5.0) + execjs (2.6.0) + globalid (0.3.6) + activesupport (>= 4.1.0) + i18n (0.7.0) + jquery-rails (4.0.4) + rails-dom-testing (~> 1.0) + railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (1.8.0) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.23) - multi_json (1.7.7) - pg (0.15.1) - polyglot (0.3.3) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.3) - rack - rack-test (0.6.2) + json (1.8.3) + loofah (2.0.3) + nokogiri (>= 1.5.9) + mail (2.6.3) + mime-types (>= 1.16, < 3) + mime-types (2.6.1) + mini_portile (0.6.2) + minitest (5.8.0) + nokogiri (1.6.6.2) + mini_portile (~> 0.6.0) + pg (0.18.2) + rack (1.6.4) + rack-test (0.6.3) rack (>= 1.0) - rails (3.2.13) - actionmailer (= 3.2.13) - actionpack (= 3.2.13) - activerecord (= 3.2.13) - activeresource (= 3.2.13) - activesupport (= 3.2.13) - bundler (~> 1.0) - railties (= 3.2.13) - railties (3.2.13) - actionpack (= 3.2.13) - activesupport (= 3.2.13) - rack-ssl (~> 1.3.2) + rails (4.2.3) + actionmailer (= 4.2.3) + actionpack (= 4.2.3) + actionview (= 4.2.3) + activejob (= 4.2.3) + activemodel (= 4.2.3) + activerecord (= 4.2.3) + activesupport (= 4.2.3) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.3) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.7) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.2) + loofah (~> 2.0) + railties (4.2.3) + actionpack (= 4.2.3) + activesupport (= 4.2.3) rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (10.1.0) - rdoc (3.12.2) - json (~> 1.4) - sass (3.2.9) - sass-rails (3.2.6) - railties (~> 3.2.0) - sass (>= 3.1.10) - tilt (~> 1.3) - sprockets (2.2.2) - hike (~> 1.2) - multi_json (~> 1.0) + thor (>= 0.18.1, < 2.0) + rake (10.4.2) + sass (3.4.16) + sass-rails (5.0.3) + railties (>= 4.0.0, < 5.0) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (~> 1.1) + sprockets (3.3.1) rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - thor (0.18.1) + sprockets-rails (2.3.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + thor (0.19.1) + thread_safe (0.3.5) tilt (1.4.1) - treetop (1.4.14) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.37) - uglifier (2.1.1) + tzinfo (1.2.2) + thread_safe (~> 0.1) + uglifier (2.7.1) execjs (>= 0.3.0) - multi_json (~> 1.0, >= 1.0.2) + json (>= 1.8.0) PLATFORMS ruby DEPENDENCIES - coffee-rails (~> 3.2.1) + coffee-rails (~> 4.1.0) jquery-rails pg - rails (= 3.2.13) - sass-rails (~> 3.2.3) - uglifier (>= 1.0.3) + rails (= 4.2.3) + sass-rails + uglifier (~> 2.7.1) + +BUNDLED WITH + 1.10.6 diff --git a/README.rdoc b/README.md similarity index 57% rename from README.rdoc rename to README.md index 5318108..37f9c0f 100644 --- a/README.rdoc +++ b/README.md @@ -1,18 +1,14 @@ -== Brighter +# Brighter -Brighter is an ultra simple, web-based, distraction free writer. Focus on writing, that's all it matters. +Brighter is an ultra simple, web-based, distraction free writer. Focus on writing, that's all it matters. -== Info +## Info -1. There is no backend. Hence, there is no tracking. nothing is saved. +1. There is no backend. Hence, there is no tracking. nothing is saved. -2. It works on all desktop browsers. Tested on Firefox, Safari and Chrome on a mac. +2. It works on all desktop browsers. Tested on Firefox, Safari and Chrome on a Mac. -3. On a mac, Cmd+f for full screen mode. On PC, Ctrl+f for full screen. +3. On a mac, **Cmd + Ctrl + f** for full screen mode. On PC, **Ctrl + f** for full screen. 4. Uses behave.js for IDE style behaviors. - - - - diff --git a/_Shiung.txt b/_Shiung.txt new file mode 100644 index 0000000..2a8eb93 --- /dev/null +++ b/_Shiung.txt @@ -0,0 +1,39 @@ +150722 == First Log == + +Recreated a new clone from the original repository. +Shiung here on first commit and setup. +Updated with log file and create "wip" branch for development. +Forgotted and made the first commit to master. + +TODO: Add in a component that changes app color theme (background and font). +TODO: Add in recognition of simple terms such as "TODO", "BUG", "ERROR", "DONE", "HELP", "HACK". +TODO: Add in programming syntax recognition and formatting. + +150818 == Second Log == +Created WIP branch to separate changes. + +Updated gems in Gemfile to the latest available versions. +Removed original 'Gemfile.lock'. + +Validated that app works locally. +Noticed a WARNING about missing secret keys when running "rails s" + +ERROR: config.eagar_load is set to nil. Please update your config/environments/*.rb files accordingly: + * development - set to false + * test - set to false + * production - set it to true + +Updated CSS formatting in assets/stylesheets/style.css + +Noticed that some files were using "Briter" instead of "Brighter" + * app/assets/views/layout/application.html.erb + * config/initializers/secret_token.rb + * config/initializers/session_store.rb + * config/locales/application.rb + * config/locales/environment.rb + * config/locales/routes.rb + +Updated README.rdoc +Another README is located in doc/README_FOR_APP + +Updated log. diff --git a/app/assets/javascripts/behave.js b/app/assets/javascripts/behave.js new file mode 100644 index 0000000..5e75f60 --- /dev/null +++ b/app/assets/javascripts/behave.js @@ -0,0 +1,633 @@ +/* + * Behave.js + * + * Copyright 2013, Jacob Kelley - http://jakiestfu.com/ + * Released under the MIT Licence + * http://opensource.org/licenses/MIT + * + * Github: http://github.com/jakiestfu/Behave.js/ + * Version: 1.5 + */ + + +(function(undefined){ + + 'use strict'; + + var BehaveHooks = BehaveHooks || (function(){ + var hooks = {}; + + return { + add: function(hookName, fn){ + if(typeof hookName == "object"){ + var i; + for(i=0; i>> 0; + if (typeof func != "function"){ + throw new TypeError(); + } + var res = [], + thisp = arguments[1]; + for (var i = 0; i < len; i++) { + if (i in t) { + var val = t[i]; + if (func.call(thisp, val, i, t)) { + res.push(val); + } + } + } + return res; + }; + } + + var defaults = { + textarea: null, + replaceTab: true, + softTabs: true, + tabSize: 4, + autoOpen: true, + overwrite: true, + autoStrip: true, + autoIndent: true, + fence: false + }, + tab, + newLine, + charSettings = { + + keyMap: [ + { open: "\"", close: "\"", canBreak: false }, + { open: "'", close: "'", canBreak: false }, + { open: "(", close: ")", canBreak: false }, + { open: "[", close: "]", canBreak: true }, + { open: "{", close: "}", canBreak: true } + ] + + }, + utils = { + + _callHook: function(hookName, passData){ + var hooks = BehaveHooks.get(hookName); + passData = typeof passData=="boolean" && passData === false ? false : true; + + if(hooks){ + if(passData){ + var theEditor = defaults.textarea, + textVal = theEditor.value, + caretPos = utils.cursor.get(), + i; + + for(i=0; i -1) { + start = end = len; + } else { + start = -textInputRange.moveStart("character", -len); + start += normalizedValue.slice(0, start).split(newLine).length - 1; + + if (textInputRange.compareEndPoints("EndToEnd", endRange) > -1) { + end = len; + } else { + end = -textInputRange.moveEnd("character", -len); + end += normalizedValue.slice(0, end).split(newLine).length - 1; + } + } + } + } + + return start==end ? false : { + start: start, + end: end + }; + } + }, + editor: { + getLines: function(textVal){ + return (textVal).split("\n").length; + }, + get: function(){ + return defaults.textarea.value.replace(/\r/g,''); + }, + set: function(data){ + defaults.textarea.value = data; + } + }, + fenceRange: function(){ + if(typeof defaults.fence == "string"){ + + var data = utils.editor.get(), + pos = utils.cursor.get(), + hacked = 0, + matchedFence = data.indexOf(defaults.fence), + matchCase = 0; + + while(matchedFence>=0){ + matchCase++; + if( pos < (matchedFence+hacked) ){ + break; + } + + hacked += matchedFence+defaults.fence.length; + data = data.substring(matchedFence+defaults.fence.length); + matchedFence = data.indexOf(defaults.fence); + + } + + if( (hacked) < pos && ( (matchedFence+hacked) > pos ) && matchCase%2===0){ + return true; + } + return false; + } else { + return true; + } + }, + isEven: function(_this,i){ + return i%2; + }, + levelsDeep: function(){ + var pos = utils.cursor.get(), + val = utils.editor.get(); + + var left = val.substring(0, pos), + levels = 0, + i, j; + + for(i=0; i=0 ? finalLevels : 0; + }, + deepExtend: function(destination, source) { + for (var property in source) { + if (source[property] && source[property].constructor && + source[property].constructor === Object) { + destination[property] = destination[property] || {}; + utils.deepExtend(destination[property], source[property]); + } else { + destination[property] = source[property]; + } + } + return destination; + }, + addEvent: function addEvent(element, eventName, func) { + if (element.addEventListener){ + element.addEventListener(eventName,func,false); + } else if (element.attachEvent) { + element.attachEvent("on"+eventName, func); + } + }, + removeEvent: function addEvent(element, eventName, func){ + if (element.addEventListener){ + element.removeEventListener(eventName,func,false); + } else if (element.attachEvent) { + element.detachEvent("on"+eventName, func); + } + }, + + preventDefaultEvent: function(e){ + if(e.preventDefault){ + e.preventDefault(); + } else { + e.returnValue = false; + } + } + }, + intercept = { + tabKey: function (e) { + + if(!utils.fenceRange()){ return; } + + if (e.keyCode == 9) { + utils.preventDefaultEvent(e); + + var toReturn = true; + utils._callHook('tab:before'); + + var selection = utils.cursor.selection(), + pos = utils.cursor.get(), + val = utils.editor.get(); + + if(selection){ + + var tempStart = selection.start; + while(tempStart--){ + if(val.charAt(tempStart)=="\n"){ + selection.start = tempStart + 1; + break; + } + } + + var toIndent = val.substring(selection.start, selection.end), + lines = toIndent.split("\n"), + i; + + if(e.shiftKey){ + for(i = 0; i