﻿/// <reference path="~/js/jquery-1.3.2-vsdoc.js"/>

/// <todo>
///		* in- & exclude classes
/// </todo>

/// <version>v1.0 - 19-7-2009</version>

;(function($){$.LinkAlert=function(options){var opties=$.extend(true,{},$.LinkAlert.defaults,options);if(opties.situation==0)return;if(opties.situation!=2){$("a[href]").each(function(){check($(this),1)})}if(opties.situation!=1){$().mousemove(function(e){if($("#linkAlertDiv").length<=0){var moveTarget=e.target;while(moveTarget.nodeName.toLowerCase()!="#document"&&moveTarget.nodeName.toUpperCase()!="A"){moveTarget=moveTarget.parentNode}if(moveTarget.nodeName.toUpperCase()=="A"&&moveTarget.href){check($(moveTarget),2)}}})}function convert(regexp){return new RegExp('^('+regexp.replace(/,/g,'|').replace(/\//g,'\\\/').replace(/\./g,'\\.').replace(/\*/g,'.*').replace(/\s+/g,'')+')([\#\?].*)?$','i')}function check(link,situ){$.each(opties.protocols,match);$.each(opties.extensions,match);$.each(opties.conditions,match);function match(key,value){if(!!value&&!!value.match&&!!value.image){if(typeof value.match==="string"){value.match=convert(value.match)}if(value.match.constructor===RegExp){if(!!value.match.test(link.attr("href"))){add(link,key,value.image,situ);if(!value.continu)return false}}else if(typeof value.match==="function"){if(!!value.match(link.context)){add(link,key,value.image,situ);if(!value.continu)return false}}}}}function add(link,name,src,situ){var img=$("<img/>").addClass("linkAlertImg").attr({title:!!name?name:"",alt:!!name?name:"",src:opties.folder+src});if(situ!=2){if($(".linkAlertSpan",link).length<=0){$("<span/>").addClass("linkAlertSpan").appendTo(link)}$(".linkAlertSpan",link).append(img)}if(situ!=1){if($("#linkAlertDiv").length<=0){$("<div/>").attr("id","linkAlertDiv").css({position:"absolute",left:-100,top:-100,"z-index":9999}).appendTo($("body"))}$("#linkAlertDiv").hide().append(img);function placeIcon(e){if(e.target){$("#linkAlertDiv").css({left:e.pageX+opties.mouseOffset[0],top:e.pageY+opties.mouseOffset[1]}).show()}}function removeIcon(){$("#linkAlertDiv").remove()}$(link).mouseenter(placeIcon).mousemove(placeIcon).focus(placeIcon).scroll(placeIcon);$(link).mouseleave(removeIcon).blur(removeIcon)}img=null}};$.LinkAlert.defaults={situation:3,folder:"",mouseOffset:[15,10],protocols:{},extensions:{},conditions:{}}})(jQuery);jQuery.LinkAlert.defaults.protocols={'About':{match:'about:*',image:'about.png'},'AIM':{match:'aim:*',image:'aim.png'},'DCHub':{match:'dchub:*',image:'dchub.png'},'eDonkey':{match:'ed2k:*',image:'ed2k.png'},'Email':{match:'mailto:*',image:'mail.png'},'Fax':{match:'fax:*',image:'fax.png'},'File':{match:'file:*',image:'file.png'},'FTP':{match:'ftp:*',image:'ftp.png'},'Gopher':{match:'gopher:*,cso:*',image:'gopher.png'},'ICQ':{match:'icq:*',image:'icq.png'},'IRC':{match:'irc:*,ircs:*',image:'irc.png'},'JavaScript':{match:'javascript:*',image:'javascript.png'},'Magnet':{match:'magnet:*',image:'magnet.png'},'News':{match:'nntp:*,news:*,snews:*,newspost:*,newsreply:*,snewspost:*,snewsreply:*',image:'news.png'},'Opera':{match:'opera:*',image:'opera.png'},'RSS':{match:'feed:*',image:'rss.png'},'SMS':{match:'sms:*,smsto:*,mms:*,mmsto:*',image:'sms.png'},'Streaming':{match:'rtsp:*,pnm:*',image:'video.png'},'Telephone':{match:'tel:*,wap:*,wtai:*',image:'phone.png'},'Telnet':{match:'telnet:*,tn3270:*,rlogin:*',image:'unknown.png'}};jQuery.LinkAlert.defaults.extensions={'Audio':{match:'*.aac,*.aiff,*.asx,*.au,*.m3u,*.mid,*.midi,*.mp3,*.ogg,*.ra,*.snd,*.wav,*.wma',image:'audio.png'},'C/C++ Source':{match:'*.cpp,*.c,*.cc,*.cxx',image:'c_source.png'},'C/C++ Header':{match:'*.h,*.hpp,*.hh,*.hxx',image:'c_header.png'},'Command':{match:'*.sh,*.bat,*.cmd,*.pif,*.vb,*.vbs,*.vba,*.wsh',image:'command.png'},'Compressed':{match:'*.zip,*.rar,*.tar,*.tgz,*.gz,*.bz2,*.tbz2,*.gzip,*.z,*.sit,*.cab,*.7z,*.lzh,*.pkg',image:'compressed.png'},'Disk Image':{match:'*.iso,*.dmg',image:'iso.png'},'DLL':{match:'*.dll,*.manifest',image:'dll.png'},'Excel':{match:'*.xls,*.xlsx,*.xlt',image:'excel.png'},'Executables':{match:'*.exe,*.scr,*.msi,*.ref,*.app,*.paf',image:'executable.png'},'Firefox Extensie':{match:'*.xpi',image:'xpi.png'},'Flash':{match:'*.swf,*.aam,*.fla',image:'flash.png'},'Image':{match:'*.jpg,*.jpe,*.jpeg,*.gif,*.png,*.bmp,*.ico,*.svg,*.svgz,*.xbm,*.drw,*.psp,*.tif,*.tiff,data:image*',image:'image.png'},'Initialization':{match:'*.ini',image:'ini.png'},'Java':{match:'*.java,*.jar,*.jad',image:'java.png'},'JavaScript':{match:'*.js',image:'javascript.png',continu:true},'OpenOffice':{match:'*.odc,*.odf,*.odm,*.odp,*ods,*.odt,*.otc,*.otf,*.otg,*.oth,*.oti,*.otp,*.ots,*.ott,*.sda,*.sdb,*.sdc,*.sdd,*.sds,*.sdw,*.sor,*.stc,*.std,*.sti,*.stw,*.sxc,*.sxd,*.sxi,*.sxg,*.sxm,*.sxw,*.vor',image:'openoffice.png'},'PDF':{match:'*.pdf',image:'pdf.png'},'PostScript':{match:'*.ps,*.eps',image:'postscript.png'},'Powerpoint':{match:'*.ppt,*.pptx,*.pps',image:'powerpoint.png'},'Python':{match:'*.py',image:'python.png'},'RSS':{match:'*.rss,*.rdf,*rss.xml,*feed.xml,*atom.xml,*/rss/feed*',image:'rss.png',continu:true},'RegEdit':{match:'*.reg',image:'regedit.png'},'Shortcut':{match:'*.lnk',image:'shortcut.png'},'Stylesheet':{match:'*.css',image:'stylesheet.png'},'Temporary':{match:'*.temp,*.tmp',image:'temporary.png'},'TeX':{match:'*.tex,*.dvi,*.latex',image:'tex.png'},'Text':{match:'*.txt,*.rtf,*.log,*.readme,*read.me',image:'text.png'},'Torrent':{match:'*.torrent',image:'torrent.png'},'Unknown':{match:'*.dat,*.bak,*.bin',image:'unknown.png'},'Userscript':{match:'*.user.js',image:'userscript.png',continu:true},'Video':{match:'*.asf,*.avi,*.mov,*.mp4,*.mpe,*.mpeg,*.mpg,*.qt,*.ram,*.rm,*.wmv',image:'video.png'},'Widget':{match:'*.widget',image:'widget.png'},'Word':{match:'*.doc,*.docx,*.dot,*.psw',image:'word.png'},'XML':{match:'*.xml',image:'xml.png',continu:true}};jQuery.LinkAlert.defaults.conditions={'External':{match:function(link){return link.hostname&&link.hostname!=location.hostname},image:'external.png',continu:true},'#Internal':{match:function(link){return link.hash&&link.href.replace(/#.*$/,"")==location.href.replace(/#.*$/,"")},image:'internal.png',continu:true},'Onclick':{match:function(link){return!!link.getAttribute("onclick")},image:'javascript.png',continu:true},'New window':{match:function(link){return link.getAttribute("target")&&link.getAttribute("target").match(/^(_blank)|(_new)|(_newwindow)$/i)},image:'new_window.png',continu:true},'Secure':{match:function(link){return link.protocol=="https:"&&location.protocol!="https:"},image:'secure.png',continu:true},'Unsecure':{match:function(link){return link.protocol!="https:"&&location.protocol=="https:"},image:'unsecure.png',continu:true}};