Browse Source

Tweaks for undocumented nag component, add indicators for incomplete components to menu, updating incomplete component docs

pull/1129/head
jlukic 10 years ago
parent
commit
ad6c5eddde
17 changed files with 363 additions and 252 deletions
  1. 10
      server/documents/elements/flag.html.eco
  2. 10
      server/documents/elements/rail.html.eco
  3. 10
      server/documents/globals/reset.html.eco
  4. 10
      server/documents/globals/site.html.eco
  5. 78
      server/documents/modules/nag.html.eco
  6. 46
      server/documents/modules/search.html.eco
  7. 22
      server/documents/modules/sticky.html.eco
  8. 4
      server/documents/modules/tab.html.eco
  9. 23
      server/documents/modules/video.html.eco
  10. 4
      server/draft/api.html.eco
  11. 10
      server/files/stylesheets/semantic.css
  12. 60
      server/layouts/default.html.eco
  13. 5
      src/definitions/behaviors/visit.js
  14. 300
      src/definitions/modules/nag.js
  15. 17
      src/definitions/modules/search.js
  16. 4
      src/themes/packages/default/modules/nag.variables
  17. 2
      src/themes/packages/default/modules/progress.variables

10
server/documents/elements/flag.html.eco

@ -16,7 +16,15 @@ type : 'UI Element'
<div class="main container">
<h2 class="ui dividing header">What Can I Use This For?</h2>
<h2 class="ui dividing header">Current Progress</h2>
<div class="ui indicating progress">
<div class="bar" style="width: 90%;">
<div class="progress">90%</div>
</div>
<div class="label">Needs Documentation</div>
</div>
<h2 class="ui dividing header">Usage</h2>
<div class="no example">
<p>Flag sprites are useful for designating political states for everything from sports matches to localization dropdowns. Just be sure not to use them to represent languages or you might get a visit from the UX police.</p>

10
server/documents/elements/rail.html.eco

@ -16,7 +16,15 @@ type : 'UI Element'
<div class="main container">
<h2 class="ui dividing header">What Can I Use This For?</h2>
<h2 class="ui dividing header">Current Progress</h2>
<div class="ui indicating progress">
<div class="bar" style="width: 90%;">
<div class="progress">90%</div>
</div>
<div class="label">Needs Documentation</div>
</div>
<h2 class="ui dividing header">Usage</h2>
<div class="no example">
<p>A rail provides a fixed-width, off-canvas content segment that that is only visible at large enough screen sizes to support their inclusion.</p>
<p>Often rail content uses a section of content that sticks to the browser viewport, following the user as they scroll down the page. This will be available in a separate component <code>ui sticky</code>.</p>

10
server/documents/globals/reset.html.eco

@ -16,7 +16,15 @@ type : 'UI Global'
<div class="main container">
<h2 class="ui dividing header">What Can I Use This For?</h2>
<h2 class="ui dividing header">Current Progress</h2>
<div class="ui indicating progress">
<div class="bar" style="width: 90%;">
<div class="progress">95%</div>
</div>
<div class="label">Needs Documentation</div>
</div>
<h2 class="ui dividing header">Usage</h2>
<div class="no example">
<p>Semantic's default theme includes the latest Normalize css to provide a base line. In addition somewhat uniquely, Semantic UI requires a <b>Box-sizing</b> reset, to make sure that all elements handle width definitions in the same way.</p>
</div>

10
server/documents/globals/site.html.eco

@ -16,7 +16,15 @@ type : 'UI Global'
<div class="main container">
<h2 class="ui dividing header">What Can I Use This For?</h2>
<h2 class="ui dividing header">Current Progress</h2>
<div class="ui indicating progress">
<div class="bar" style="width: 90%;">
<div class="progress">95%</div>
</div>
<div class="label">Needs Documentation</div>
</div>
<h2 class="ui dividing header">Usage</h2>
<div class="no example">
<p>Semantic includes a basic set of site parameters, including paragraph spacing, page line-height, body font size, color hex-code definitions, and other globally pertinent themable values</p>
<p>In addition Semantic provides utilities to include common web fonts available through Google Fonts, and include them as part of UI themes.</p>

78
server/documents/modules/nag.html.eco

@ -0,0 +1,78 @@
---
layout : 'default'
css : ''
element : 'nag'
elementType : 'module'
title : 'Nag'
description : 'A nag is an important message that persists until dismissed by a user'
type : 'UI Module'
status : 'Undocumented'
---
<%- @partial('header', { tabs: { overview: 'Overview' } }) %>
<div class="main container">
<div class="ui active tab" data-tab="overview">
<h2 class="ui dividing header">Current Progress</h2>
<div class="ui indicating progress">
<div class="bar" style="width: 60%;">
<div class="progress">60%</div>
</div>
<div class="label">Needs Documentation / Re-coding</div>
</div>
<h2 class="ui dividing header">Usage</h2>
<div class="no example">
<h4 class="ui header"></h4>
<p>Nags are used to present a user with a one time message which will persist until a user acknowledges the message. This can be used for providing notices like the site's use of cookies, or an importan change to a site like a security breach, or an important event.</p>
<p>Semantic's nag component provides built in options for ensuring a nag is only displayed once. You can trigger an API endpoint on dismissal, in order to store a value in your database, or you can use localstorage or cookie value to make sure that a particular computer does not receive the nag again.</p>
</div>
<h2 class="ui dividing header">Example</h2>
<div class="code" data-type="javascript" data-demo="true">
// Wont re-appear unless cleared
$('.cookie.nag')
.nag('show')
;
</div>
<div class="code" data-type="javascript" data-demo="true">
// Clears cookie so above example works again
$('.cookie.nag')
.nag('clear')
;
</div>
<div class="ui code" data-type="html" data-preview="true">
<div class="ui inline cookie nag">
<span class="title">
We use cookies to ensure you get the best experience on our website
</span>
<i class="close icon"></i>
</div>
</div>
<div class="evaluated code" data-type="javascript">
// Automatically shows on init if cookie isnt set
$('.cookie.nag')
.nag({
key : 'accepts-cookies',
value : true
})
;
</div>
<h2 class="ui dividing header">Support Development</h2>
<div class="no example">
<p>You can help support the future development of the Semantic UI project, and help boost the priority of this component by donating to Semantic UI development.</p>
<p>Please be sure to leave a note in the comments to indicate that you are interested in the development of this particular component.</p>
</div>
</div>
</div>

46
server/documents/modules/search.html.eco

@ -0,0 +1,46 @@
---
layout : 'default'
css : ''
element : 'search'
elementType : 'module'
title : 'Search'
description : 'A search module is used to allow a user to query a large selection of values.'
type : 'UI Module'
status : 'Undocumented'
---
<%- @partial('header', { tabs: { overview: 'Overview' } }) %>
<div class="main container">
<div class="ui active tab" data-tab="overview">
<h2 class="ui dividing header">Current Progress</h2>
<div class="ui indicating progress">
<div class="bar" style="width: 90%;">
<div class="progress">90%</div>
</div>
<div class="label">Needs Documentation</div>
</div>
<h2 class="ui dividing header">Usage</h2>
<div class="no example">
<h4 class="ui header">Autocomplete Results</h4>
<p>Search allows you to query either remote endpoints, with the <b>API behavior</b> or local javascript objects for search results which are then presented in-place below the search prompt.</p>
<p>Semantic's search component can group displayed results by category, or as a simple list, and has built in keyboard support and custom error message routing, as well as support for navigating to full text results from within the autocomplete menu.</p>
</div>
<h2 class="ui dividing header">Support Development</h2>
<div class="no example">
<p>You can help support the future development of the Semantic UI project, and help boost the priority of this component by donating to Semantic UI development.</p>
<p>Please be sure to leave a note in the comments to indicate that you are interested in the development of this particular component.</p>
</div>
</div>
</div>

22
server/documents/modules/sticky.html.eco

@ -8,11 +8,9 @@ title : 'Sticky'
description : 'A sticky provides a wrapper for sticky embeds from common 3rd party sources.'
type : 'UI Module'
themes : ['Default']
status : 'Undocumented'
---
<script src="/javascript/sticky.js"></script>
<%- @partial('header', { tabs: { overview: 'Overview' } }) %>
<div class="main container">
@ -20,7 +18,15 @@ themes : ['Default']
<div class="ui active tab" data-tab="overview">
<h2 class="ui dividing header">What Can I Use This For?</h2>
<h2 class="ui dividing header">Current Progress</h2>
<div class="ui indicating progress">
<div class="bar" style="width: 90%;">
<div class="progress">90%</div>
</div>
<div class="label">Needs Documentation</div>
</div>
<h2 class="ui dividing header">Usage</h2>
<div class="no example">
<h4 class="ui header">Content on Rails</h4>
<p>Sticky allows for content to stick itself to a different elements viewport, so that it remains on screen as long as its related content is visible</p>
@ -39,10 +45,6 @@ themes : ['Default']
<div class="no example">
<p>This is an undocumented component, but is <b>mostly complete</b>.</p>
<div class="ui teal active progress">
<div class="bar" style="width: 75%;"></div>
</div>
<p>You can help support the future development of the Semantic UI project, and help boost the priority of this component by donating to Semantic UI development.</p>
<p>Please be sure to leave a note in the comments to indicate that you are interested in the development of this particular component.</p>
@ -50,6 +52,4 @@ themes : ['Default']
</div>
</div>
</body>
</html>
</div>

4
server/documents/modules/tab.html.eco

@ -393,6 +393,4 @@ themes : ['Default']
</table>
</div>
</div>
</body>
</html>
</div>

23
server/documents/modules/video.html.eco

@ -8,7 +8,7 @@ title : 'Video'
description : 'A video provides a wrapper for video embeds from common 3rd party sources.'
type : 'UI Module'
themes : ['Default']
status : 'Undocumented'
---
<script src="/javascript/video.js"></script>
@ -20,7 +20,15 @@ themes : ['Default']
<div class="ui active tab" data-tab="overview">
<h2 class="ui dividing header">What Can I Use This For?</h2>
<h2 class="ui dividing header">Current Progress</h2>
<div class="ui indicating progress">
<div class="bar" style="width: 90%;">
<div class="progress">90%</div>
</div>
<div class="label">Needs Documentation</div>
</div>
<h2 class="ui dividing header">Usage</h2>
<div class="no example">
<h4 class="ui header">Many Networks One API</h4>
<p>Semantic's video component provides a wrapper around APIs for two popular sites for hosting multimedia content, Youtube and Vimeo, allowing you to use a single embed and unified set of javascript parameters, to control javascript callbacks, HD and UI display settings, autoplay etc.</p>
@ -54,20 +62,13 @@ themes : ['Default']
</div>
<h2 class="ui dividing header">Development Progress</h2>
<div class="no example">
<p>This is an undocumented component, but is <b>mostly complete</b>.</p>
<div class="ui teal active progress">
<div class="bar" style="width: 75%;"></div>
</div>
<p>You can help support the future development of the Semantic UI project, and help boost the priority of this component by donating to Semantic UI development.</p>
<p>Please be sure to leave a note in the comments to indicate that you are interested in the development of this particular component.</p>
</div>
</div>
</div>
</body>
</html>
</div>

server/documents/modules/api.html.eco → server/draft/api.html.eco

@ -150,6 +150,4 @@ themes : ['Default']
</div>
</div>
</body>
</html>
</div>

10
server/files/stylesheets/semantic.css

@ -155,6 +155,7 @@ a:hover {
---------------*/
#example #menu .item {
position: relative;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
@ -162,8 +163,15 @@ a:hover {
#example #menu .item .circular.label {
position: absolute;
top: 0.75rem;
right: 1
right: 1em;
opacity: 0.2;
transition: background 0.3s ease;
}
#example #menu .item.active > .circular.label,
#example #menu .item:hover > .circular.label {
opacity: 0.8;
}
#example #menu .inverted.header {
color: rgba(255, 255, 255, 0.8);
margin-bottom: 0.5em;

60
server/layouts/default.html.eco

@ -67,10 +67,12 @@
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/modal.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/accordion.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/dropdown.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/nag.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/popup.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/progress.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/rating.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/sidebar.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/search.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/shape.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/sticky.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/tab.css">
@ -131,9 +133,11 @@
<script src="/build/uncompressed/definitions/modules/dimmer.js"></script>
<script src="/build/uncompressed/definitions/modules/dropdown.js"></script>
<script src="/build/uncompressed/definitions/modules/modal.js"></script>
<script src="/build/uncompressed/definitions/modules/nag.js"></script>
<script src="/build/uncompressed/definitions/modules/popup.js"></script>
<script src="/build/uncompressed/definitions/modules/progress.js"></script>
<script src="/build/uncompressed/definitions/modules/rating.js"></script>
<script src="/build/uncompressed/definitions/modules/search.js"></script>
<script src="/build/uncompressed/definitions/modules/shape.js"></script>
<script src="/build/uncompressed/definitions/modules/sidebar.js"></script>
<script src="/build/uncompressed/definitions/modules/sticky.js"></script>
@ -182,11 +186,12 @@
<div class="ui small <%= if @document.elementType is 'global' then 'active ' %> inverted header">Globals</div>
<div class="menu">
<% for element in uiGlobals: %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>">
<%= element.title %>
<% if element.status?: %>
<span class="ui mini empty yellow circular ui label"></span>
<% end %>
</a>
<% if element.status? is 'Undocumented': %>
<div class="ui mini empty yellow ui label"></div>
<% end %>
<% end %>
</div>
</div>
@ -194,11 +199,12 @@
<div class="ui small <%= if @document.elementType is 'element' then 'active ' %> inverted header">Elements</div>
<div class="menu">
<% for element in uiElements: %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>">
<%= element.title %>
<% if element.status?: %>
<span class="ui mini empty yellow circular ui label"></span>
<% end %>
</a>
<% if element.status? is 'Undocumented': %>
<div class="ui mini empty yellow ui label"></div>
<% end %>
<% end %>
</div>
</div>
@ -206,11 +212,12 @@
<div class="ui small <%= if @document.elementType is 'collection' then 'active ' %> inverted header">Collections</div>
<div class="menu">
<% for element in uiCollections: %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>">
<%= element.title %>
<% if element.status?: %>
<span class="ui mini empty yellow circular ui label"></span>
<% end %>
</a>
<% if element.status? is 'Undocumented': %>
<div class="ui mini empty yellow ui label"></div>
<% end %>
<% end %>
</div>
</div>
@ -218,11 +225,12 @@
<div class="ui small <%= if @document.elementType is 'view' then 'active ' %> inverted header">Views</div>
<div class="menu">
<% for element in uiViews: %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>">
<%= element.title %>
<% if element.status?: %>
<span class="ui mini empty yellow circular ui label"></span>
<% end %>
</a>
<% if element.status? is 'Undocumented': %>
<div class="ui mini empty yellow ui label"></div>
<% end %>
<% end %>
</div>
</div>
@ -230,11 +238,12 @@
<a href="/module.html" class="ui small <%= if @document.elementType is 'module' then 'active ' %> inverted header">Modules</a>
<div class="menu">
<% for element in uiModules: %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>">
<%= element.title %>
<% if element.status?: %>
<span class="ui mini empty yellow circular ui label"></span>
<% end %>
</a>
<% if element.status? is 'Undocumented': %>
<div class="ui mini empty yellow ui label"></div>
<% end %>
<% end %>
</div>
</div>
@ -242,11 +251,12 @@
<div class="ui small <%= if @document.elementType is 'behavior' then 'active ' %> inverted header">Behaviors</div>
<div class="menu">
<% for element in uiBehavior: %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>">
<%= element.title %>
<% if element.status?: %>
<span class="ui mini empty yellow circular ui label"></span>
<% end %>
</a>
<% if element.status? is 'Undocumented': %>
<div class="ui mini empty yellow ui label"></div>
<% end %>
<% end %>
</div>
</div>
@ -334,7 +344,7 @@
<div class="ui inverted link list">
<a class="item" href="mailto:jack@semantic-ui.com?subject=Help Translating">Translate</a>
<a class="item" href="https://github.com/Semantic-Org/Semantic-UI" target="_blank">Issue Tracker</a>
<a class="item" href="cla.html" target="_blank">Contributor License Agreement</a>
<a class="item" href="cla.html" target="_blank">CLA</a>
<a class="disabled item">Create Themes</a>
</div>
</div>

5
src/definitions/behaviors/visit.js

@ -497,7 +497,7 @@ $.fn.visit.settings = {
expires : 30,
domain : false,
path : false,
path : '/',
onLimit : function() {},
onChange : function() {},
@ -511,3 +511,6 @@ $.fn.visit.settings = {
};
})( jQuery, window , document );
/*! jquery.cookie v1.4.1 | MIT */
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}});

300
src/definitions/modules/nag.js

@ -15,21 +15,23 @@
$.fn.nag = function(parameters) {
var
$allModules = $(this),
moduleSelector = $allModules.selector || '',
$allModules = $(this),
moduleSelector = $allModules.selector || '',
time = new Date().getTime(),
performance = [],
time = new Date().getTime(),
performance = [],
query = arguments[0],
methodInvoked = (typeof query == 'string'),
queryArguments = [].slice.call(arguments, 1),
query = arguments[0],
methodInvoked = (typeof query == 'string'),
queryArguments = [].slice.call(arguments, 1),
returnedValue
;
$(this)
$allModules
.each(function() {
var
settings = $.extend(true, {}, $.fn.nag.settings, parameters),
settings = ( $.isPlainObject(parameters) )
? $.extend(true, {}, $.fn.nag.settings, parameters)
: $.extend({}, $.fn.nag.settings),
className = settings.className,
selector = settings.selector,
@ -42,8 +44,9 @@ $.fn.nag = function(parameters) {
$module = $(this),
$close = $module.find(selector.close),
$context = $(settings.context),
$context = (settings.context)
? $(settings.context)
: $('body'),
element = this,
instance = $module.data(moduleNamespace),
@ -71,12 +74,6 @@ $.fn.nag = function(parameters) {
initialize: function() {
module.verbose('Initializing element');
// calculate module offset once
moduleOffset = $module.offset();
moduleHeight = $module.outerHeight();
contextWidth = $context.outerWidth();
contextHeight = $context.outerHeight();
contextOffset = $context.offset();
$module
.data(moduleNamespace, module)
@ -84,43 +81,18 @@ $.fn.nag = function(parameters) {
$close
.on('click' + eventNamespace, module.dismiss)
;
// lets avoid javascript if we dont need to reposition
if(settings.context == window && settings.position == 'fixed') {
if(settings.detachable && $module.parent()[0] !== $context[0]) {
$module
.addClass(className.fixed)
.detach()
.prependTo($context)
;
}
if(settings.sticky) {
module.verbose('Adding scroll events');
// retrigger on scroll for absolute
if(settings.position == 'absolute') {
$context
.on('scroll' + eventNamespace, module.event.scroll)
.on('resize' + eventNamespace, module.event.scroll)
;
}
// fixed is always relative to window
else {
$(window)
.on('scroll' + eventNamespace, module.event.scroll)
.on('resize' + eventNamespace, module.event.scroll)
;
}
// fire once to position on init
$.proxy(module.event.scroll, this)();
}
if(settings.displayTime > 0) {
setTimeout(module.hide, settings.displayTime);
}
if(module.should.show()) {
if( !$module.is(':visible') ) {
module.show();
}
}
else {
module.hide();
}
module.show();
},
destroy: function() {
@ -129,33 +101,21 @@ $.fn.nag = function(parameters) {
.removeData(moduleNamespace)
.off(eventNamespace)
;
if(settings.sticky) {
$context
.off(eventNamespace)
;
}
},
refresh: function() {
module.debug('Refreshing cached calculations');
moduleOffset = $module.offset();
moduleHeight = $module.outerHeight();
contextWidth = $context.outerWidth();
contextHeight = $context.outerHeight();
contextOffset = $context.offset();
},
show: function() {
module.debug('Showing nag', settings.animation.show);
if(settings.animation.show == 'fade') {
$module
.fadeIn(settings.duration, settings.easing)
;
}
else {
$module
.slideDown(settings.duration, settings.easing)
;
if( module.should.show() && !$module.is(':visible') ) {
module.debug('Showing nag', settings.animation.show);
if(settings.animation.show == 'fade') {
$module
.fadeIn(settings.duration, settings.easing)
;
}
else {
$module
.slideDown(settings.duration, settings.easing)
;
}
}
},
@ -181,43 +141,9 @@ $.fn.nag = function(parameters) {
}
},
stick: function() {
module.refresh();
if(settings.position == 'fixed') {
var
windowScroll = $(window).prop('pageYOffset') || $(window).scrollTop(),
fixedOffset = ( $module.hasClass(className.bottom) )
? contextOffset.top + (contextHeight - moduleHeight) - windowScroll
: contextOffset.top - windowScroll
;
$module
.css({
position : 'fixed',
top : fixedOffset,
left : contextOffset.left,
width : contextWidth - settings.scrollBarWidth
})
;
}
else {
$module
.css({
top : yPosition
})
;
}
},
unStick: function() {
$module
.css({
top : ''
})
;
},
dismiss: function(event) {
if(settings.storageMethod) {
module.storage.set(settings.storedKey, settings.storedValue);
module.storage.set(settings.key, settings.value);
}
module.hide();
event.stopImmediatePropagation();
@ -230,76 +156,91 @@ $.fn.nag = function(parameters) {
module.debug('Persistent nag is set, can show nag');
return true;
}
if(module.storage.get(settings.storedKey) != settings.storedValue) {
module.debug('Stored value is not set, can show nag', module.storage.get(settings.storedKey));
if( module.storage.get(settings.key) != settings.value.toString() ) {
module.debug('Stored value is not set, can show nag', module.storage.get(settings.key));
return true;
}
module.debug('Stored value is set, cannot show nag', module.storage.get(settings.storedKey));
module.debug('Stored value is set, cannot show nag', module.storage.get(settings.key));
return false;
},
stick: function() {
yOffset = $context.prop('pageYOffset') || $context.scrollTop();
yPosition = ( $module.hasClass(className.bottom) )
? (contextHeight - $module.outerHeight() ) + yOffset
: yOffset
}
},
get: {
storageOptions: function() {
var
options = {}
;
// absolute position calculated when y offset met
if(yPosition > moduleOffset.top) {
return true;
if(settings.expires) {
options.expires = settings.expires;
}
else if(settings.position == 'fixed') {
return true;
if(settings.domain) {
options.domain = settings.domain;
}
return false;
if(settings.path) {
options.path = settings.path;
}
return options;
}
},
storage: {
clear: function() {
module.storage.remove(settings.key);
},
storage: {
set: function(key, value) {
module.debug('Setting stored value', key, value, settings.storageMethod);
if(settings.storageMethod == 'local' && window.store !== undefined) {
window.store.set(key, value);
var
options = module.get.storageOptions()
;
if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
window.localStorage.setItem(key, value);
module.debug('Value stored using local storage', key, value);
}
// store by cookie
else if($.cookie !== undefined) {
$.cookie(key, value);
$.cookie(key, value, options);
module.debug('Value stored using cookie', key, value, options);
}
else {
module.error(error.noStorage);
module.error(error.noCookieStorage);
return;
}
},
get: function(key) {
module.debug('Getting stored value', key, settings.storageMethod);
if(settings.storageMethod == 'local' && window.store !== undefined) {
return window.store.get(key);
get: function(key, value) {
var
storedValue
;
if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
storedValue = window.localStorage.getItem(key);
}
// get by cookie
else if($.cookie !== undefined) {
return $.cookie(key);
storedValue = $.cookie(key);
}
else {
module.error(error.noCookieStorage);
}
if(storedValue == 'undefined' || storedValue == 'null' || storedValue === undefined || storedValue === null) {
storedValue = undefined;
}
return storedValue;
},
remove: function(key) {
var
options = module.get.storageOptions()
;
if(settings.storageMethod == 'local' && window.store !== undefined) {
window.localStorage.removeItem(key);
}
// store by cookie
else if($.cookie !== undefined) {
$.removeCookie(key, options);
}
else {
module.error(error.noStorage);
}
}
},
event: {
scroll: function() {
if(timer !== undefined) {
clearTimeout(timer);
}
timer = setTimeout(function() {
if(module.should.stick() ) {
requestAnimationFrame(module.stick);
}
else {
module.unStick();
}
}, settings.lag);
}
},
setting: function(name, value) {
module.debug('Changing setting', name, value);
if( $.isPlainObject(name) ) {
@ -313,14 +254,11 @@ $.fn.nag = function(parameters) {
}
},
internal: function(name, value) {
module.debug('Changing internal', name, value);
if(value !== undefined) {
if( $.isPlainObject(name) ) {
$.extend(true, module, name);
}
else {
module[name] = value;
}
if( $.isPlainObject(name) ) {
$.extend(true, module, name);
}
else if(value !== undefined) {
module[name] = value;
}
else {
return module[name];
@ -388,9 +326,6 @@ $.fn.nag = function(parameters) {
if(moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if($allModules.size() > 1) {
title += ' ' + '(' + $allModules.size() + ')';
}
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
console.groupCollapsed(title);
if(console.table) {
@ -438,6 +373,7 @@ $.fn.nag = function(parameters) {
return false;
}
else {
module.error(error.method, query);
return false;
}
});
@ -460,6 +396,7 @@ $.fn.nag = function(parameters) {
return found;
}
};
if(methodInvoked) {
if(instance === undefined) {
module.initialize();
@ -472,9 +409,9 @@ $.fn.nag = function(parameters) {
}
module.initialize();
}
})
;
return (returnedValue !== undefined)
? returnedValue
: this
@ -494,46 +431,40 @@ $.fn.nag.settings = {
// allows cookie to be overriden
persist : false,
// set to zero to manually dismiss, otherwise hides on its own
// set to zero to require manually dismissal, otherwise hides on its own
displayTime : 0,
animation : {
show: 'slide',
hide: 'slide'
show : 'slide',
hide : 'slide'
},
// method of stickyness
position : 'fixed',
scrollBarWidth : 18,
context : false,
detachable : false,
expires : 30,
domain : false,
path : '/',
// type of storage to use
storageMethod : 'cookie',
storageMethod : 'cookie',
// value to store in dismissed localstorage/cookie
storedKey : 'nag',
storedValue : 'dismiss',
// need to calculate stickyness on scroll
sticky : false,
// how often to check scroll event
lag : 0,
// context for scroll event
context : window,
key : 'nag',
value : 'dismiss',
error: {
noStorage : 'Neither $.cookie or store is defined. A storage solution is required for storing state',
noStorage : 'Neither $.cookie or store is defined. A storage solution is required for storing state',
method : 'The method you called is not defined.'
},
className : {
bottom : 'bottom',
fixed : 'fixed'
bottom : 'bottom',
fixed : 'fixed'
},
selector : {
close: '.icon.close'
close : '.close.icon'
},
speed : 500,
@ -544,3 +475,6 @@ $.fn.nag.settings = {
};
})( jQuery, window , document );
/*! jquery.cookie v1.4.1 | MIT */
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}});

17
src/definitions/modules/search.js

@ -271,7 +271,6 @@ $.fn.search = function(parameters) {
searchFields = $.isArray(settings.searchFields)
? settings.searchFields
: [settings.searchFields],
searchRegExp = new RegExp('(?:\s|^)' + searchTerm, 'i'),
fullTextRegExp = new RegExp(searchTerm, 'i'),
searchHTML
@ -281,13 +280,17 @@ $.fn.search = function(parameters) {
;
// iterate through search fields in array order
$.each(searchFields, function(index, field) {
$.each(settings.source, function(label, thing) {
if(typeof thing[field] == 'string' && ($.inArray(thing, results) == -1) && ($.inArray(thing, fullTextResults) == -1) ) {
if( searchRegExp.test( thing[field] ) ) {
results.push(thing);
$.each(settings.source, function(label, content) {
var
fieldExists = (typeof content[field] == 'string'),
notAlreadyResult = ($.inArray(content, results) == -1 && $.inArray(content, fullTextResults) == -1)
;
if(fieldExists && notAlreadyResult) {
if( searchRegExp.test( content[field] ) ) {
results.push(content);
}
else if( fullTextRegExp.test( thing[field] ) ) {
fullTextResults.push(thing);
else if( fullTextRegExp.test( content[field] ) ) {
fullTextResults.push(content);
}
}
});

4
src/themes/packages/default/modules/nag.variables

@ -8,13 +8,13 @@
@position: relative;
@width: 100%;
@zIndex: 101;
@zIndex: 999;
@margin: 0em;
@background: #555555;
@opacity: 0.95;
@minHeight: 0em;
@padding: 0.5em 1em;
@padding: 0.75em 1em;
@lineHeight: 1em;
@boxShadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.2);

2
src/themes/packages/default/modules/progress.variables

@ -12,7 +12,7 @@
@lastMargin: 0em 0em (@labelHeight);
@background: @subtleTransparentBlack;
@border: 1px solid @borderColor;
@border: 1px solid rgba(0, 0, 0, 0.05);
@boxShadow: none;
@padding: 0.325em;
@borderRadius: 0.325em;

Loading…
Cancel
Save