Skip to content
Browse files

More magnus plugins

Signed-off-by: Sebastian Skuse <seb@skuse.net>
  • Loading branch information...
1 parent 5f9432a commit a042907416df4223937c199020a5704c438e8fc9 @sebskuse sebskuse committed Feb 6, 2012
Showing with 326 additions and 0 deletions.
  1. +67 −0 print.js
  2. +62 −0 tweet.js
  3. +58 −0 wave.js
  4. +69 −0 webdictionary.js
  5. +70 −0 wiki.js
View
67 print.js
@@ -0,0 +1,67 @@
+(function(){
+
+ var pluginName = "print";
+ var plugin = function(){
+
+ $lib = AtKit.lib();
+
+ settings = {
+ "baseURL": "http://c.atbar.org/ATBar/"
+ };
+
+ if(/https:/.test(window.location.protocol)){
+ settings.baseURL = "https://ssl.atbar.org/c/ATBar/";
+ }
+
+ // Internationalisation
+ AtKit.addLocalisationMap("GB", {
+ "print_title" : "Print page"
+ });
+
+ // Print
+ AtKit.addButton(
+ 'print',
+ AtKit.localisation("print_title"),
+ AtKit.getPluginURL() + 'images/printer.png',
+ function(dialogs, functions){
+
+ if(window['ppw']&&ppw['bookmarklet']){
+ ppw.bookmarklet.toggle();
+ }
+ else { window._pwyl_home="http://www.printwhatyoulike.com/";
+ _pwyl_bmkl=document.createElement('script');
+ _pwyl_bmkl.setAttribute('type','text/javascript');
+ _pwyl_bmkl.setAttribute('src',_pwyl_home+'static/compressed/pwyl_bookmarklet_10.js');
+ _pwyl_bmkl.setAttribute('pwyl','true');
+ document.getElementsByTagName('head')[0].appendChild(_pwyl_bmkl);
+ }
+
+ },
+ null, null
+ );
+
+ };
+
+ if(typeof window['AtKit'] == "undefined"){
+
+ window.AtKitLoaded = function(){
+ var eventAction = null;
+
+ this.subscribe = function(fn) {
+ eventAction = fn;
+ };
+
+ this.fire = function(sender, eventArgs) {
+ if (eventAction != null) {
+ eventAction(sender, eventArgs);
+ }
+ };
+ }
+
+ window['AtKitLoaded'] = new AtKitLoaded();
+ window['AtKitLoaded'].subscribe(function(){ AtKit.registerPlugin(pluginName, plugin); });
+ } else {
+ AtKit.registerPlugin(pluginName, plugin);
+ }
+
+})();
View
62 tweet.js
@@ -0,0 +1,62 @@
+(function(){
+
+ var pluginName = "tweet";
+ var plugin = function(){
+
+ $lib = AtKit.lib();
+
+ settings = {
+ "baseURL": "http://c.atbar.org/ATBar/"
+ };
+
+ if(/https:/.test(window.location.protocol)){
+ settings.baseURL = "https://ssl.atbar.org/c/ATBar/";
+ }
+
+ // Internationalisation
+ AtKit.addLocalisationMap("GB", {
+ "tweet_title" : "Tweet this page"
+ });
+
+ // Tweet
+ AtKit.addButton(
+ 'tweet',
+ AtKit.localisation("tweet_title"),
+ AtKit.getPluginURL() + 'images/twitter.png',
+ function(dialogs, functions){
+
+ f='http://twitter.com/share?url='+encodeURIComponent(window.location.href)+'&text='+encodeURIComponent(document.title);
+ a=function(){window.open(f,'twitterui','location=yes,links=no,scrollbars=yes,toolbar=no,status=no,width=550,height=450')};
+
+ if(/Firefox/.test(navigator.userAgent)){
+ setTimeout(a,0)}else{a()
+ }
+ },
+ null, null
+ );
+
+ };
+
+ if(typeof window['AtKit'] == "undefined"){
+
+ window.AtKitLoaded = function(){
+ var eventAction = null;
+
+ this.subscribe = function(fn) {
+ eventAction = fn;
+ };
+
+ this.fire = function(sender, eventArgs) {
+ if (eventAction != null) {
+ eventAction(sender, eventArgs);
+ }
+ };
+ }
+
+ window['AtKitLoaded'] = new AtKitLoaded();
+ window['AtKitLoaded'].subscribe(function(){ AtKit.registerPlugin(pluginName, plugin); });
+ } else {
+ AtKit.registerPlugin(pluginName, plugin);
+ }
+
+})();
View
58 wave.js
@@ -0,0 +1,58 @@
+(function(){
+
+ var pluginName = "wave";
+ var plugin = function(){
+
+ $lib = AtKit.lib();
+
+ settings = {
+ "baseURL": "http://c.atbar.org/ATBar/"
+ };
+
+ if(/https:/.test(window.location.protocol)){
+ settings.baseURL = "https://ssl.atbar.org/c/ATBar/";
+ }
+
+ // Internationalisation
+ AtKit.addLocalisationMap("GB", {
+ "wave_title" : "Use WAVE accessibility checker"
+ });
+
+ // WAVE
+ AtKit.addButton(
+ 'wave',
+ AtKit.localisation("wave_title"),
+ AtKit.getPluginURL() + 'images/wave.png',
+ function(dialogs, functions){
+
+ window.open('http://wave.webaim.org/report?url='+escape(window.location))
+
+ },
+ null, null
+ );
+
+ };
+
+ if(typeof window['AtKit'] == "undefined"){
+
+ window.AtKitLoaded = function(){
+ var eventAction = null;
+
+ this.subscribe = function(fn) {
+ eventAction = fn;
+ };
+
+ this.fire = function(sender, eventArgs) {
+ if (eventAction != null) {
+ eventAction(sender, eventArgs);
+ }
+ };
+ }
+
+ window['AtKitLoaded'] = new AtKitLoaded();
+ window['AtKitLoaded'].subscribe(function(){ AtKit.registerPlugin(pluginName, plugin); });
+ } else {
+ AtKit.registerPlugin(pluginName, plugin);
+ }
+
+})();
View
69 webdictionary.js
@@ -0,0 +1,69 @@
+(function(){
+
+ var pluginName = "webdictionary";
+ var plugin = function(){
+
+ $lib = AtKit.lib();
+
+ settings = {
+ "baseURL": "http://c.atbar.org/ATBar/"
+ };
+
+ if(/https:/.test(window.location.protocol)){
+ settings.baseURL = "https://ssl.atbar.org/c/ATBar/";
+ }
+
+ // Internationalisation
+ AtKit.addLocalisationMap("GB", {
+ "webdictionary_title" : "Use the dictionary"
+ });
+
+ // Web Dictionary
+ AtKit.addButton(
+ 'webdictionary',
+ AtKit.localisation("webdictionary_title"),
+ AtKit.getPluginURL() + 'images/dictionary.png',
+ function(dialogs, functions){
+
+ try{
+ var b=window.getSelection(),a=b?b.toString().replace(/(^\W+|\W+$)/g,''):'';
+
+ if(!a){
+ a=prompt('Enter a word to look up');
+ if(!a)return
+ }
+ var c='http://dictionary.reference.com/search?r=1&q='+encodeURIComponent(a);window.open(c)
+ }
+ catch(d){
+ alert('Error:\n'+d.message)
+ }
+
+ },
+ null, null
+ );
+
+ };
+
+ if(typeof window['AtKit'] == "undefined"){
+
+ window.AtKitLoaded = function(){
+ var eventAction = null;
+
+ this.subscribe = function(fn) {
+ eventAction = fn;
+ };
+
+ this.fire = function(sender, eventArgs) {
+ if (eventAction != null) {
+ eventAction(sender, eventArgs);
+ }
+ };
+ }
+
+ window['AtKitLoaded'] = new AtKitLoaded();
+ window['AtKitLoaded'].subscribe(function(){ AtKit.registerPlugin(pluginName, plugin); });
+ } else {
+ AtKit.registerPlugin(pluginName, plugin);
+ }
+
+})();
View
70 wiki.js
@@ -0,0 +1,70 @@
+(function(){
+
+ var pluginName = "wiki";
+ var plugin = function(){
+
+ $lib = AtKit.lib();
+
+ settings = {
+ "baseURL": "http://c.atbar.org/ATBar/"
+ };
+
+ if(/https:/.test(window.location.protocol)){
+ settings.baseURL = "https://ssl.atbar.org/c/ATBar/";
+ }
+
+ // Internationalisation
+ AtKit.addLocalisationMap("GB", {
+ "wiki_title" : "Search Wikipedia"
+ });
+
+ // Wiki
+ AtKit.addButton(
+ 'wiki',
+ AtKit.localisation("wiki_title"),
+ AtKit.getPluginURL() + 'images/wikipedia.png',
+ function(dialogs, functions){
+
+ try{
+ var b=window.getSelection(),a=b?b.toString().replace(/(^\W+|\W+$)/g,''):'';
+
+ if(!a){
+ a=prompt('Enter a word to look up on Wikipedia');
+ if(!a)return
+ }
+ var c='http://en.wikipedia.org/w/wiki.phtml?search='+encodeURIComponent(a);
+ window.open(c)
+ }
+ catch(d){
+ alert('Error:\n'+d.message)
+ }
+
+ },
+ null, null
+ );
+
+ };
+
+ if(typeof window['AtKit'] == "undefined"){
+
+ window.AtKitLoaded = function(){
+ var eventAction = null;
+
+ this.subscribe = function(fn) {
+ eventAction = fn;
+ };
+
+ this.fire = function(sender, eventArgs) {
+ if (eventAction != null) {
+ eventAction(sender, eventArgs);
+ }
+ };
+ }
+
+ window['AtKitLoaded'] = new AtKitLoaded();
+ window['AtKitLoaded'].subscribe(function(){ AtKit.registerPlugin(pluginName, plugin); });
+ } else {
+ AtKit.registerPlugin(pluginName, plugin);
+ }
+
+})();

0 comments on commit a042907

Please sign in to comment.
Something went wrong with that request. Please try again.