הבדלים בין גרסאות בדף "מדיה ויקי:BookmarkletsInit.js"

מתוך חב"דפדיה, אנציקלופדיה חב"דית חופשית
קפיצה לניווט קפיצה לחיפוש
 
(גרסת ביניים אחת של משתמש אחר אחד אינה מוצגת)
שורה 1: שורה 1:
function create_bookmarklets() {
+
( function () {
    var stubparts = [
+
'use strict';
"javascript:(function(){if(typeof(",  
+
 
")=='undefined'){var s=document.createElement('script');s.setAttribute('src','http://chabadpedia.co.il/index.php?title= ",
+
var stubparts, bookmarklets, bookmarkletsWrong,
"&action=raw&maxage=3600&ctype=text/javascript&dontcountme=s');document.getElementsByTagName('body')[0].appendChild(s);}else ",
+
$bookmarkletsList = $( '#bookmarkletsList' );
 +
 
 +
stubparts = [
 +
"javascript:(function(){if(typeof(",
 +
")=='undefined'){var s=document.createElement('script');s.setAttribute('src','//chabadpedia.co.il/index.php?title= ",
 +
"&action=raw&maxage=3600&ctype=text/javascript&dontcountme=s');document.getElementsByTagName('head')[0].appendChild(s);}else ",
 
"();})()"
 
"();})()"
 
];
 
];
var bookmarklets = [
+
 
{func: 'wikiit', sourcepage: 'Mediawiki:Common.js/externalsmaker.js' , name: 'תבנית לחב"דפדיה', description: 'יצירת תבנית קישור מכתבות באתרים חב"דיים (חב"ד אינפו, חב"ד בישראל ועוד): '},
+
bookmarklets = [
{func: 'coords', sourcepage: 'Mediawiki:Common.js/coords.js', name: 'תבנית coord', description: 'יצירת תבנית coord ממפה של גוגל או עמוד ענן (ראו הוראות למטה): '}
+
{
 +
func: 'wikiit',
 +
sourcepage: 'MediaWiki:Common.js/externalsmaker.js',
 +
name: 'תבנית לחב"דפדיה',
 +
description: ' '
 +
}
 
];
 
];
var $ol = $("#bmList ol:first");
+
 
$ol.contents().remove();
+
bookmarkletsWrong = function ( e ) {
$(bookmarklets).each(function(idx, item){
 
$("<li>").text(item.description)
 
.append(
 
$("<a>",
 
{
 
"href": stubparts[0] + item.func + stubparts[1]+ item.sourcepage + stubparts[2] + item.func + stubparts[3],
 
"click": bookmarlets_wrong,
 
"text" : item.name
 
}
 
)
 
).appendTo($ol)
 
});
 
 
function bookmarlets_wrong(e)
 
{
 
 
e.preventDefault();
 
e.preventDefault();
alert('את הקישור יש לגרור לסרגל המועדפים, ולהפעיל באתרים הנתמכים.\nקישור זה לא מיועד להפעלה מתוך חב"דפדיה. למידע נוסף קראו את ההוראות בדף.');
+
alert( 'את הקישור יש לגרור לסרגל המועדפים, ולהפעיל באתרים המתאימים.' +
}
+
'\nקישור זה לא מיועד להפעלה מתוך חב"דפדיה. למידע נוסף קראו את ההוראות בדף.'
+
);
};
+
};
 +
 
 +
$bookmarkletsList.empty();
 +
 
 +
$( bookmarklets ).each( function( i, bookmarklet ) {
 +
var $link, $item;
 +
 
 +
$link = $( '<a>' )
 +
.prop( 'href', stubparts[0] + bookmarklet.func +
 +
stubparts[1] + bookmarklet.sourcepage +
 +
stubparts[2] + bookmarklet.func +
 +
stubparts[3] )
 +
.click( bookmarkletsWrong )
 +
.text( bookmarklet.name );
 +
 
 +
$item = $( '<li>' )
 +
.text( bookmarklet.description )
 +
.append( $link );
  
$(create_bookmarklets);
+
$bookmarkletsList.append( $item );
 +
} );
 +
} )();

גרסה אחרונה מ־16:36, 7 במרץ 2024

( function () {
	'use strict';

	var stubparts, bookmarklets, bookmarkletsWrong,
		$bookmarkletsList = $( '#bookmarkletsList' );

	stubparts = [
		"javascript:(function(){if(typeof(",
		")=='undefined'){var s=document.createElement('script');s.setAttribute('src','//chabadpedia.co.il/index.php?title= ",
		"&action=raw&maxage=3600&ctype=text/javascript&dontcountme=s');document.getElementsByTagName('head')[0].appendChild(s);}else ",
		"();})()"
	];

	bookmarklets = [
		{
			func: 'wikiit',
			sourcepage: 'MediaWiki:Common.js/externalsmaker.js',
			name: 'תבנית לחב"דפדיה',
			description: ' '
		}
	];

	bookmarkletsWrong = function ( e ) {
		e.preventDefault();
		alert( 'את הקישור יש לגרור לסרגל המועדפים, ולהפעיל באתרים המתאימים.' +
			'\nקישור זה לא מיועד להפעלה מתוך חב"דפדיה. למידע נוסף קראו את ההוראות בדף.'
		);
	};

	$bookmarkletsList.empty();

	$( bookmarklets ).each( function( i, bookmarklet ) {
		var $link, $item;

		$link = $( '<a>' )
			.prop( 'href', stubparts[0] + bookmarklet.func +
				stubparts[1] + bookmarklet.sourcepage +
				stubparts[2] + bookmarklet.func +
				stubparts[3] )
			.click( bookmarkletsWrong )
			.text( bookmarklet.name );

		$item = $( '<li>' )
			.text( bookmarklet.description )
			.append( $link );

		$bookmarkletsList.append( $item );
	} );
} )();