Browse files

Version 1.3

  • Loading branch information...
1 parent 00547b9 commit aeaae08ade8562c69bbdc77e391e82aa2d6b8997 @kmendes committed Jan 17, 2012
View
14 Instructions.txt
@@ -2,11 +2,13 @@ Demo and unit testing: tests/photo_tags/index.html
1. Reference css and javascript files:
-<link media="screen" type="text/css" href="/static/photo-tag/libraries/jquery-ui-1.8.11.custom.css" rel="stylesheet">
-<link media="screen" type="text/css" href="/static/photo-tag/tests/photo_tags/styles2.css" rel="stylesheet">
-<script type="text/javascript" src="/static/photo-tag/libraries/jquery.dev.1.5.1.js"></script>
-<script type="text/javascript" src="/static/photo-tag/libraries/jquery.ui.1.8.11.js"></script>
-<script type="text/javascript" src="/static/photo-tag/js/jquery.phototag.js?ver=1"></script>
+
+<script src="../../libraries/jquery.dev.1.7.1.js" type="text/javascript"></script>
+<script src="../../libraries/jquery-ui-1.8.17.custom.min.js" type="text/javascript"></script>
+<script src="../../js/jquery.phototag.js" type="text/javascript"></script>
+
+<link rel="stylesheet" href="../../libraries/jquery-ui-1.8.17.custom.css" type="text/css" media="screen" />
+<link rel="stylesheet" href="styles2.css" type="text/css" media="screen" />
2. Call the photo tag plguin on load:
$(document).ready(function(){
@@ -26,4 +28,4 @@ $(document).ready(function(){
});
3. Add the image
-<img src="http://karlmendes.com/static/photo-tag/tests/photo_tags/monkeys2.jpg" class="photoTag userId_25 imageId_200 albumId_200">
+<img src="http://karlmendes.com/static/photo-tag/tests/photo_tags/monkeys2.jpg" class="photoTag" data-user-id="25" data-image-id="200" data-album-id="200">
View
84 libraries/blackbird/blackbird.css
@@ -1,84 +0,0 @@
-/*
- Blackbird - Open Source JavaScript Logging Utility
- Author: G Scott Olson
- Web: http://blackbirdjs.googlecode.com/
- http://www.gscottolson.com/blackbirdjs/
- Version: 1.0
-
- The MIT License - Copyright (c) 2008 Blackbird Project
-*/
-#blackbird { margin:0; padding:0; position:fixed; _position:absolute; font:11px/1.3 Consolas, 'Lucida Console', Monaco, monospace; _border:2px solid #BBB; }
-#blackbird.bbTopLeft { top:0; left:0; _top:expression(eval(document.documentElement.scrollTop+8)); _left:expression(eval(document.documentElement.scrollLeft+8)); }
-#blackbird.bbTopRight { top:0; right:0; }
-* html .bbTopRight { right:auto; top:expression(eval(document.documentElement.scrollTop+8)); left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById('blackbird').offsetWidth-8)); }
-#blackbird.bbBottomLeft { bottom:0; left:0; }
-* html .bbBottomLeft { bottom:auto; top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-document.getElementById('blackbird').offsetHeight-8)); left:expression(eval(document.documentElement.scrollLeft+8)); }
-#blackbird.bbBottomRight { bottom:0; right:0; }
-* html .bbBottomRight { bottom:auto; right:auto; top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-document.getElementById('blackbird').offsetHeight-8)); left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById('blackbird').offsetWidth-8)); }
-
-#blackbird.bbSmall { width:300px; _width:272px; }
- #blackbird.bbSmall .header { _width:272px; }
- #blackbird.bbSmall .header div.left, #blackbird.bbSmall .footer div.left { width:150px; }
- #blackbird.bbSmall .main { _width:272px; }
- #blackbird.bbSmall .main div { height:200px; }
- #blackbird.bbSmall .main div.mainBody { width:272px; }
- #blackbird.bbSmall .footer { _width:272px; }
-
-#blackbird.bbLarge { width:500px; _width:472px; }
- #blackbird.bbLarge .header { _width:472px; }
- #blackbird.bbLarge .header div.left, #blackbird.bbLarge .footer div.left { width:350px; }
- #blackbird.bbLarge .main { _width:472px; }
- #blackbird.bbLarge .main div { height:500px; }
- #blackbird.bbLarge .main div.mainBody { width:472px; }
- #blackbird.bbLarge .footer { _width:472px; }
-
-#blackbird .header span { position:relative; width:16px; height:16px; margin:0 4px; float:left; background-image:url(blackbird_icons.png); background-repeat:no-repeat; }
- #blackbird .header span.error { background-position:0px 0px; }
- #blackbird .header span.errorDisabled { background-position:-16px 0px; }
- #blackbird .header span.warn { background-position:0px -16px; }
- #blackbird .header span.warnDisabled { background-position:-16px -16px; }
- #blackbird .header span.info { background-position:0px -32px; }
- #blackbird .header span.infoDisabled { background-position:-16px -32px; }
- #blackbird .header span.debug { background-position:0px -48px; }
- #blackbird .header span.debugDisabled { background-position:-16px -48px; }
- #blackbird .header span.profile { background-position:0px -64px; }
- #blackbird .header span.profileDisabled { background-position:-16px -64px; }
- #blackbird .header span.close { background-position:0px -80px; }
- #blackbird .header span.clear { background-position:-16px -80px; }
- #blackbird .header span.small { background-position:0px -96px; }
- #blackbird .header span.large { background-position:-16px -96px; }
-
-#blackbird .header > div, #blackbird .main > div, #blackbird .footer > div { background-image:url(blackbird_panel.png); background-repeat:no-repeat; }
-
-#blackbird .header div { float:left; _background-color:#000; }
- #blackbird .header div.left { background-position:top left; height:40px; _height:16px; }
- #blackbird .header .left div.filters { margin-left: -4px; padding:16px 0 0 19px; float:left; _padding:6px 8px; }
- #blackbird .header div.right { background-position:top right; height:40px; width:150px; _width:122px; _height:16px; }
- #blackbird .header .right div.controls { padding:16px 24px 0 0; float:right; _padding:6px 8px; }
- #blackbird .header .right .controls span { margin:0; }
- #blackbird .header .right .controls span.clear { margin-right:8px; }
-
-#blackbird .main div { float:left; }
- #blackbird .main div.left { background-position:0 -30px; width:11px; _width:0; }
- #blackbird .main div.mainBody { background-position:40% -40px; _background-color:#000; _filter:alpha(opacity='93'); }
- #blackbird .main .mainBody ol { line-height: 1.45; height:100%; overflow:auto; width:100%; list-style-type:none; margin:0; padding:0; }
- #blackbird .main .mainBody ol li { padding:1px 4px 1px 30px; border-bottom: 1px solid #333; color:#CCC; margin: 2px 2px; _text-indent: -2px; }
- #blackbird .main .mainBody ol li span { background:url(blackbird_icons.png) no-repeat 0 0; border: 1px solid #333; height:16px; width:16px; display:block; float:left; margin: -2px 0 1px -25px; _display:inline; }
-
-#blackbird .main .mainBody ol li.error span { background-position:0 0; }
-#blackbird .main .mainBody ol li.warn span { background-position:0 -16px; }
-#blackbird .main .mainBody ol li.info span { background-position:0 -32px; }
-#blackbird .main .mainBody ol li.debug span { background-position:0 -48px; }
-#blackbird .main .mainBody ol li.profile span { background-position:0 -64px; }
-
-#blackbird .main .mainBody ol li.profile { color:#DDD; font-style:italic; }
-
-#blackbird .errorHidden li.error, #blackbird .warnHidden li.warn, #blackbird .infoHidden li.info, #blackbird .debugHidden li.debug, #blackbird .profileHidden li.profile { display:none; }
-
-#blackbird .main div.right { background:url(blackbird_panel.png) no-repeat 100% -30px; width:17px; _width:0; }
-
-#blackbird .footer div { height:50px; float:left; _background-color:#000; _height:30px; }
-#blackbird .footer div.left { background-position:bottom left; _width:100% !important; }
- #blackbird .footer div.left label { display:block;color:#BBB;margin:8px 0 0 16px; position:relative; font-family:Arial,sans-serif; _margin:4px 0 0 8px;}
- #blackbird .footer div.left label input { padding:0;vertical-align:middle; }
-#blackbird .footer div.right { background-position:bottom right; width:150px; _width:0; }
View
346 libraries/blackbird/blackbird.js
@@ -1,346 +0,0 @@
-/*
- Blackbird - Open Source JavaScript Logging Utility
- Author: G Scott Olson
- Web: http://blackbirdjs.googlecode.com/
- http://www.gscottolson.com/blackbirdjs/
- Version: 1.0
-
- The MIT License - Copyright (c) 2008 Blackbird Project
-*/
-( function() {
- var NAMESPACE = 'log';
- var IE6_POSITION_FIXED = true; // enable IE6 {position:fixed}
-
- var bbird;
- var outputList;
- var cache = [];
-
- var state = getState();
- var classes = {};
- var profiler = {};
- var IDs = {
- blackbird: 'blackbird',
- checkbox: 'bbVis',
- filters: 'bbFilters',
- controls: 'bbControls',
- size: 'bbSize'
- }
- var messageTypes = { //order of these properties imply render order of filter controls
- debug: true,
- info: true,
- warn: true,
- error: true,
- profile: true
- };
-
- function generateMarkup() { //build markup
- var spans = [];
- for ( type in messageTypes ) {
- spans.push( [ '<span class="', type, '" type="', type, '"></span>'].join( '' ) );
- }
-
- var newNode = document.createElement( 'DIV' );
- newNode.id = IDs.blackbird;
- newNode.style.display = 'none';
- newNode.innerHTML = [
- '<div class="header">',
- '<div class="left">',
- '<div id="', IDs.filters, '" class="filters" title="click to filter by message type">', spans.join( '' ), '</div>',
- '</div>',
- '<div class="right">',
- '<div id="', IDs.controls, '" class="controls">',
- '<span id="', IDs.size ,'" title="contract" op="resize"></span>',
- '<span class="clear" title="clear" op="clear"></span>',
- '<span class="close" title="close" op="close"></span>',
- '</div>',
- '</div>',
- '</div>',
- '<div class="main">',
- '<div class="left"></div><div class="mainBody">',
- '<ol>', cache.join( '' ), '</ol>',
- '</div><div class="right"></div>',
- '</div>',
- '<div class="footer">',
- '<div class="left"><label for="', IDs.checkbox, '"><input type="checkbox" id="', IDs.checkbox, '" />Visible on page load</label></div>',
- '<div class="right"></div>',
- '</div>'
- ].join( '' );
- return newNode;
- }
-
- function backgroundImage() { //(IE6 only) change <BODY> tag's background to resolve {position:fixed} support
- var bodyTag = document.getElementsByTagName( 'BODY' )[ 0 ];
-
- if ( bodyTag.currentStyle && IE6_POSITION_FIXED ) {
- if (bodyTag.currentStyle.backgroundImage == 'none' ) {
- bodyTag.style.backgroundImage = 'url(about:blank)';
- }
- if (bodyTag.currentStyle.backgroundAttachment == 'scroll' ) {
- bodyTag.style.backgroundAttachment = 'fixed';
- }
- }
- }
-
- function addMessage( type, content ) { //adds a message to the output list
- content = ( content.constructor == Array ) ? content.join( '' ) : content;
- if ( outputList ) {
- var newMsg = document.createElement( 'LI' );
- newMsg.className = type;
- newMsg.innerHTML = [ '<span class="icon"></span>', content ].join( '' );
- outputList.appendChild( newMsg );
- scrollToBottom();
- } else {
- cache.push( [ '<li class="', type, '"><span class="icon"></span>', content, '</li>' ].join( '' ) );
- }
- }
-
- function clear() { //clear list output
- outputList.innerHTML = '';
- }
-
- function clickControl( evt ) {
- if ( !evt ) evt = window.event;
- var el = ( evt.target ) ? evt.target : evt.srcElement;
-
- if ( el.tagName == 'SPAN' ) {
- switch ( el.getAttributeNode( 'op' ).nodeValue ) {
- case 'resize': resize(); break;
- case 'clear': clear(); break;
- case 'close': hide(); break;
- }
- }
- }
-
- function clickFilter( evt ) { //show/hide a specific message type
- if ( !evt ) evt = window.event;
- var span = ( evt.target ) ? evt.target : evt.srcElement;
-
- if ( span && span.tagName == 'SPAN' ) {
-
- var type = span.getAttributeNode( 'type' ).nodeValue;
-
- if ( evt.altKey ) {
- var filters = document.getElementById( IDs.filters ).getElementsByTagName( 'SPAN' );
-
- var active = 0;
- for ( entry in messageTypes ) {
- if ( messageTypes[ entry ] ) active++;
- }
- var oneActiveFilter = ( active == 1 && messageTypes[ type ] );
-
- for ( var i = 0; filters[ i ]; i++ ) {
- var spanType = filters[ i ].getAttributeNode( 'type' ).nodeValue;
-
- filters[ i ].className = ( oneActiveFilter || ( spanType == type ) ) ? spanType : spanType + 'Disabled';
- messageTypes[ spanType ] = oneActiveFilter || ( spanType == type );
- }
- }
- else {
- messageTypes[ type ] = ! messageTypes[ type ];
- span.className = ( messageTypes[ type ] ) ? type : type + 'Disabled';
- }
-
- //build outputList's class from messageTypes object
- var disabledTypes = [];
- for ( type in messageTypes ) {
- if ( ! messageTypes[ type ] ) disabledTypes.push( type );
- }
- disabledTypes.push( '' );
- outputList.className = disabledTypes.join( 'Hidden ' );
-
- scrollToBottom();
- }
- }
-
- function clickVis( evt ) {
- if ( !evt ) evt = window.event;
- var el = ( evt.target ) ? evt.target : evt.srcElement;
-
- state.load = el.checked;
- setState();
- }
-
-
- function scrollToBottom() { //scroll list output to the bottom
- outputList.scrollTop = outputList.scrollHeight;
- }
-
- function isVisible() { //determine the visibility
- return ( bbird.style.display == 'block' );
- }
-
- function hide() {
- bbird.style.display = 'none';
- }
-
- function show() {
- var body = document.getElementsByTagName( 'BODY' )[ 0 ];
- body.removeChild( bbird );
- body.appendChild( bbird );
- bbird.style.display = 'block';
- }
-
- //sets the position
- function reposition( position ) {
- if ( position === undefined || position == null ) {
- position = ( state && state.pos === null ) ? 1 : ( state.pos + 1 ) % 4; //set to initial position ('topRight') or move to next position
- }
-
- switch ( position ) {
- case 0: classes[ 0 ] = 'bbTopLeft'; break;
- case 1: classes[ 0 ] = 'bbTopRight'; break;
- case 2: classes[ 0 ] = 'bbBottomLeft'; break;
- case 3: classes[ 0 ] = 'bbBottomRight'; break;
- }
- state.pos = position;
- setState();
- }
-
- function resize( size ) {
- if ( size === undefined || size === null ) {
- size = ( state && state.size == null ) ? 0 : ( state.size + 1 ) % 2;
- }
-
- classes[ 1 ] = ( size === 0 ) ? 'bbSmall' : 'bbLarge'
-
- var span = document.getElementById( IDs.size );
- span.title = ( size === 1 ) ? 'small' : 'large';
- span.className = span.title;
-
- state.size = size;
- setState();
- scrollToBottom();
- }
-
- function setState() {
- var props = [];
- for ( entry in state ) {
- var value = ( state[ entry ] && state[ entry ].constructor === String ) ? '"' + state[ entry ] + '"' : state[ entry ];
- props.push( entry + ':' + value );
- }
- props = props.join( ',' );
-
- var expiration = new Date();
- expiration.setDate( expiration.getDate() + 14 );
- document.cookie = [ 'blackbird={', props, '}; expires=', expiration.toUTCString() ,';' ].join( '' );
-
- var newClass = [];
- for ( word in classes ) {
- newClass.push( classes[ word ] );
- }
- bbird.className = newClass.join( ' ' );
- }
-
- function getState() {
- var re = new RegExp( /blackbird=({[^;]+})(;|\b|$)/ );
- var match = re.exec( document.cookie );
- return ( match && match[ 1 ] ) ? eval( '(' + match[ 1 ] + ')' ) : { pos:null, size:null, load:null };
- }
-
- //event handler for 'keyup' event for window
- function readKey( evt ) {
- if ( !evt ) evt = window.event;
- var code = 113; //F2 key
-
- if ( evt && evt.keyCode == code ) {
-
- var visible = isVisible();
-
- if ( visible && evt.shiftKey && evt.altKey ) clear();
- else if (visible && evt.shiftKey ) reposition();
- else if ( !evt.shiftKey && !evt.altKey ) {
- ( visible ) ? hide() : show();
- }
- }
- }
-
- //event management ( thanks John Resig )
- function addEvent( obj, type, fn ) {
- var obj = ( obj.constructor === String ) ? document.getElementById( obj ) : obj;
- if ( obj.attachEvent ) {
- obj[ 'e' + type + fn ] = fn;
- obj[ type + fn ] = function(){ obj[ 'e' + type + fn ]( window.event ) };
- obj.attachEvent( 'on' + type, obj[ type + fn ] );
- } else obj.addEventListener( type, fn, false );
- }
- function removeEvent( obj, type, fn ) {
- var obj = ( obj.constructor === String ) ? document.getElementById( obj ) : obj;
- if ( obj.detachEvent ) {
- obj.detachEvent( 'on' + type, obj[ type + fn ] );
- obj[ type + fn ] = null;
- } else obj.removeEventListener( type, fn, false );
- }
-
- window[ NAMESPACE ] = {
- toggle:
- function() { ( isVisible() ) ? hide() : show(); },
- resize:
- function() { resize(); },
- clear:
- function() { clear(); },
- move:
- function() { reposition(); },
- debug:
- function( msg ) { addMessage( 'debug', msg ); },
- warn:
- function( msg ) { addMessage( 'warn', msg ); },
- info:
- function( msg ) { addMessage( 'info', msg ); },
- error:
- function( msg ) { addMessage( 'error', msg ); },
- profile:
- function( label ) {
- var currentTime = new Date(); //record the current time when profile() is executed
-
- if ( label == undefined || label == '' ) {
- addMessage( 'error', '<b>ERROR:</b> Please specify a label for your profile statement' );
- }
- else if ( profiler[ label ] ) {
- addMessage( 'profile', [ label, ': ', currentTime - profiler[ label ], 'ms' ].join( '' ) );
- delete profiler[ label ];
- }
- else {
- profiler[ label ] = currentTime;
- addMessage( 'profile', label );
- }
- return currentTime;
- }
- }
-
- addEvent( window, 'load',
- /* initialize Blackbird when the page loads */
- function() {
- var body = document.getElementsByTagName( 'BODY' )[ 0 ];
- bbird = body.appendChild( generateMarkup() );
- outputList = bbird.getElementsByTagName( 'OL' )[ 0 ];
-
- backgroundImage();
-
- //add events
- addEvent( IDs.checkbox, 'click', clickVis );
- addEvent( IDs.filters, 'click', clickFilter );
- addEvent( IDs.controls, 'click', clickControl );
- addEvent( document, 'keyup', readKey);
-
- resize( state.size );
- reposition( state.pos );
- if ( state.load ) {
- show();
- document.getElementById( IDs.checkbox ).checked = true;
- }
-
- scrollToBottom();
-
- window[ NAMESPACE ].init = function() {
- show();
- window[ NAMESPACE ].error( [ '<b>', NAMESPACE, '</b> can only be initialized once' ] );
- }
-
- addEvent( window, 'unload', function() {
- removeEvent( IDs.checkbox, 'click', clickVis );
- removeEvent( IDs.filters, 'click', clickFilter );
- removeEvent( IDs.controls, 'click', clickControl );
- removeEvent( document, 'keyup', readKey );
- });
- });
-})();
View
BIN libraries/blackbird/blackbird_icons.png
Deleted file not rendered
View
BIN libraries/blackbird/blackbird_panel.png
Deleted file not rendered
View
1 tests/photo_tags/index.html
@@ -112,7 +112,6 @@
}
};
$('.photoTag').photoTag(options);
- //$('.photoTag').photoTag();
ok(true,'Clear');
});

0 comments on commit aeaae08

Please sign in to comment.