summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-02-01 22:31:05 +0200
committeremkael <emkael@tlen.pl>2017-02-01 22:31:05 +0200
commit6125d79af39158c678706f5c3483c5aaebbe74b4 (patch)
tree071d53850987f8b81ae53f762338bb94e57b22bf
* initial version of iframe embed
-rw-r--r--vcards.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/vcards.js b/vcards.js
new file mode 100644
index 0000000..8d72869
--- /dev/null
+++ b/vcards.js
@@ -0,0 +1,49 @@
+if (typeof JFRTEAMY_VCARDS == 'undefined') {
+ JFRTEAMY_VCARDS = true;
+ window.onload = function() {
+ var idPattern = /r=([0-9]*)/;
+ var links = document.getElementsByTagName('a');
+ var fotoSpan = document.getElementById('foto');
+ var loader = document.createElement('img');
+ loader.src = 'images/A.gif';
+ loader.style.display = 'none';
+ loader.style.margin = '0 30px';
+ fotoSpan.parentNode.insertBefore(loader, fotoSpan);
+ var loadedPid = undefined;
+ for (var i = 0; i < links.length; i++) {
+ var link = new URL(links[i].href);
+ if (link.hostname.substr(-10) == 'msc.com.pl') {
+ var pidMatch = link.search.match(idPattern);
+ if (pidMatch) {
+ var pid = pidMatch[1];
+ if (parseInt(pid) < 30000) {
+ links[i].onmouseover = (function(p) { return function() {
+ if (p != loadedPid) {
+ var iframeURL = 'http://cezar.brydzystow.pl/' + p;
+ var iframe = document.createElement('iframe');
+ iframe.src = iframeURL;
+ iframe.onload = function() {
+ iframe.width = '600px';
+ iframe.height = '500px';
+ iframe.style.border = 'none';
+ fotoSpan.style.visibility = 'visible';
+ loader.style.display = 'none';
+ }
+ fotoSpan.innerHTML = '';
+ loader.style.display = 'inline-block';
+ fotoSpan.style.visibility = 'hidden';
+ fotoSpan.append(iframe);
+ loadedPid = p;
+ }
+ }})(pid);
+ } else {
+ links[i].href = '#';
+ links[i].onmouseover = function() {
+ fotoSpan.innerHTML = '';
+ }
+ }
+ }
+ }
+ }
+ }
+}