CARVIEW |
Select Language
HTTP/2 200
date: Sat, 26 Jul 2025 19:32:32 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"b9e898d0e53b181e58cb1bc35eea5f4b"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=UuqYKSqNRHHKSHI9xCZL0zII2RJ9%2BNhSycTfLQTCpL7fT%2FxrwVjVLxQUC%2FhrWIO1Iv2zSuEMYVWw03b%2BqlEOpa4k1sM0Hy5h%2BnZHOX%2FRBPoAKRXf7WiIwqnnwhP%2FSpSF%2ByUJ5u7mMzXdE4kRufK0pyQmFv%2Fmlr8XODm15yt1znnE2fhEoEp1%2B1hnI8%2FS5h9PG%2FJDcawJ9e1un1maHDKh1f9XjD7qI%2FwLPS80wgBhe%2BO3U9t6vAi%2BnQxictFzfKRC6%2B17uTzTPT7VJOt9OsSZFA%3D%3D--x%2Bmti6n9SQtr6Joq--a%2BaPjTgJ7Tw9MRSbs%2Be8sQ%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.858791465.1753558351; Path=/; Domain=github.com; Expires=Sun, 26 Jul 2026 19:32:31 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sun, 26 Jul 2026 19:32:31 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: 882E:3240E6:87686A:AEF475:68852D4F
jQuery Interlink Plugin · GitHub
Show Gist options
Save Golpha/c5c7ae9b6ed11dc93ce6 to your computer and use it in GitHub Desktop.
{{ message }}
Instantly share code, notes, and snippets.
Golpha/jquery.interlink.js Secret
Last active
February 28, 2022 22:53
-
Star
1
(1)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
Save Golpha/c5c7ae9b6ed11dc93ce6 to your computer and use it in GitHub Desktop.
jQuery Interlink Plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* jQuery Interlink Plugin | |
* | |
* Developed by Matthias "nihylum" Kaschubowski ( Jan 17, 2016 ) | |
* Available and archived at invisible.directory | |
* | |
* (c) 2016 Matthias Kaschubowski | |
* | |
* License: MIT | |
*/ | |
interlinkDebug = $(document.currentScript).data('debug') ? true : false; | |
var interlink = function(target) { | |
this.target = target; | |
this.debug = interlinkDebug; | |
if ( this.debug ) | |
{ | |
console.log('Interlink processing task started.'); | |
} | |
this.match = function(props) | |
{ | |
if ( typeof props === 'object' ) | |
{ | |
var state = true; | |
for ( dataKey in props ) | |
{ | |
if ( typeof props[dataKey].source === 'undefined' ) | |
{ | |
if ( this.debug ) | |
{ | |
console.log('Trying to match entire string:' + props[dataKey]); | |
} | |
if ( this.target.data(dataKey) !== props[dataKey] && state === true ) | |
{ | |
state = false; | |
} | |
} | |
if ( typeof props[dataKey].source === 'string' ) | |
{ | |
if ( this.debug ) | |
{ | |
console.log('Trying to match regular expression:' + props[dataKey]); | |
} | |
if ( typeof this.target.data(dataKey) !== 'undefined' && ! props[dataKey].test(this.target.data(dataKey)) ) | |
{ | |
state = false; | |
} | |
} | |
} | |
if ( this.debug ) | |
{ | |
console.log('Matching task completed, result is: ' + state); | |
} | |
return state; | |
} | |
else if ( typeof props !== 'undefined' ) | |
{ | |
throw "IllegalFormatException: match property must be an object or undefined"; | |
} | |
return true; | |
}; | |
this.applyStyles = function(styles) | |
{ | |
this.target.css(styles); | |
}; | |
this.engage = function(event, handler, fetchParams, components) | |
{ | |
this.target.on(event, handler); | |
if ( typeof fetchParams === 'object' ) | |
{ | |
var ajaxParams = $.extend({ | |
interlinkHandler: handler, | |
interlinkTarget: this.target, | |
interlinkEvent: event, | |
interlinkComponents: components, | |
}, fetchParams); | |
$.ajax(ajaxParams).done(function(data, status, xhr) { | |
var reponse = { | |
data: data, | |
status: status, | |
xhr: xhr, | |
}; | |
this.interlinkTarget.trigger( | |
this.interlinkEvent, | |
[ | |
this.interlinkTarget, | |
components, | |
reponse | |
] | |
); | |
}); | |
return; | |
} | |
}; | |
}; | |
(function( $ ) { | |
$.fn.interlink = function(settings, event) | |
{ | |
if ( typeof settings !== 'object' ) | |
{ | |
throw "IllegalFormatException: settings argument must hold an object"; | |
} | |
if ( typeof settings.components === 'object' && typeof settings.links === 'object' ) | |
{ | |
if ( typeof React === 'undefined' ) | |
{ | |
throw "DependencyMissingException: React.js library is not loaded."; | |
} | |
if ( interlinkDebug ) | |
{ | |
console.log('Interlink is in react mode'); | |
} | |
var components = {}; | |
for ( currentComponent in settings.components ) | |
{ | |
if ( typeof settings.components[currentComponent] !== 'object' ) | |
{ | |
throw "IllegalFormatException: components property must hold and array of objects"; | |
} | |
if ( interlinkDebug ) | |
{ | |
console.log('Interlink React-Component created: ' + currentComponent); | |
} | |
components[currentComponent] = React.createClass(settings.components[currentComponent]); | |
} | |
if ( interlinkDebug ) | |
{ | |
console.log('Interlink has created ' + components.length + ' components'); | |
} | |
settings = settings.links; | |
} | |
this.each(function() { | |
var linker = new interlink($(this)); | |
for ( key in settings ) | |
{ | |
var info = settings[key]; | |
var currentEvent = info.event || event; | |
var currentMatch = info.match || {}; | |
if ( typeof currentEvent === 'undefined' ) | |
{ | |
throw "UnexpectedEventCascade: No event defined for link " + key; | |
} | |
if ( linker.match(currentMatch) ) | |
{ | |
if ( linker.debug ) | |
{ | |
console.log('Interlink matched on key "' + key + '"') | |
} | |
if ( typeof info.style === 'object' ) | |
{ | |
linker.applyStyles(info.style); | |
} | |
if ( info.handler ) | |
{ | |
linker.engage(currentEvent, info.handler, this.fetch, components); | |
} | |
} | |
} | |
if ( typeof event === 'string' ) | |
{ | |
$(this).trigger(event, [this, components]); | |
} | |
}); | |
return this; | |
}; | |
})( jQuery ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Example Page: regular example</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react-dom.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script> | |
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script> | |
<script src="jquery.interlink.js" data-debug="false"></script> | |
</head> | |
<body> | |
<div class="example-target" data-foo="foo"> | |
</div> | |
<div class="example-target" data-foo="bar"> | |
</div> | |
<script type="text/babel"> | |
$('.example-target').interlink({ | |
components: { | |
common: { | |
render: function() | |
{ | |
return ( | |
<p className="foo">{this.props.message}</p> | |
); | |
}, | |
}, | |
}, | |
links: { | |
foo: { | |
match: { | |
foo: 'bar', | |
}, | |
style: { | |
backgroundColor: 'silver', | |
}, | |
handler: function(event, element, components) | |
{ | |
ReactDOM.render( | |
<components.common message="string matching" />, | |
element | |
); | |
}, | |
}, | |
bar: { | |
match: { | |
foo: /f(.*)/g, | |
}, | |
style: { | |
backgroundColor: 'blue', | |
color: 'white', | |
}, | |
handler: function(event, element, components) | |
{ | |
ReactDOM.render( | |
<components.common message="regular expression matching" />, | |
element | |
); | |
}, | |
}, | |
}, | |
}, 'ui:init'); | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Example Page: regular example</title> | |
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script> | |
<script src="jquery.interlink.js" data-debug="false"></script> | |
</head> | |
<body> | |
<div class="example-target" data-foo="foo"> | |
</div> | |
<div class="example-target" data-foo="bar"> | |
</div> | |
<script> | |
$('.example-target').interlink({ | |
foo: { | |
match: { | |
foo: 'bar', | |
}, | |
style: { | |
backgroundColor: 'silver', | |
}, | |
handler: function(event, element) | |
{ | |
element.html( | |
'<p>string matching</p>' | |
); | |
}, | |
}, | |
bar: { | |
match: { | |
foo: /f(.*)/g, | |
}, | |
style: { | |
backgroundColor: 'blue', | |
color: 'white', | |
}, | |
handler: function(event, element) | |
{ | |
element.html( | |
'<p>regex matching</p>' | |
); | |
}, | |
}, | |
}, 'ui:init'); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can’t perform that action at this time.